1 | // Copyright 2013 The Flutter Authors. All rights reserved. |
---|---|
2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. |
4 | |
5 | #ifndef FLUTTER_ASSETS_ASSET_MANAGER_H_ |
6 | #define FLUTTER_ASSETS_ASSET_MANAGER_H_ |
7 | |
8 | #include <deque> |
9 | #include <memory> |
10 | #include <string> |
11 | |
12 | #include "flutter/assets/asset_resolver.h" |
13 | #include "flutter/fml/macros.h" |
14 | #include "flutter/fml/memory/ref_counted.h" |
15 | |
16 | namespace flutter { |
17 | |
18 | class AssetManager final : public AssetResolver { |
19 | public: |
20 | AssetManager(); |
21 | |
22 | ~AssetManager() override; |
23 | |
24 | void PushFront(std::unique_ptr<AssetResolver> resolver); |
25 | |
26 | void PushBack(std::unique_ptr<AssetResolver> resolver); |
27 | |
28 | // |AssetResolver| |
29 | bool IsValid() const override; |
30 | |
31 | // |AssetResolver| |
32 | std::unique_ptr<fml::Mapping> GetAsMapping( |
33 | const std::string& asset_name) const override; |
34 | |
35 | private: |
36 | std::deque<std::unique_ptr<AssetResolver>> resolvers_; |
37 | |
38 | FML_DISALLOW_COPY_AND_ASSIGN(AssetManager); |
39 | }; |
40 | |
41 | } // namespace flutter |
42 | |
43 | #endif // FLUTTER_ASSETS_ASSET_MANAGER_H_ |
44 |