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_DIRECTORY_ASSET_BUNDLE_H_
6#define FLUTTER_ASSETS_DIRECTORY_ASSET_BUNDLE_H_
7
8#include "flutter/assets/asset_resolver.h"
9#include "flutter/fml/macros.h"
10#include "flutter/fml/memory/ref_counted.h"
11#include "flutter/fml/unique_fd.h"
12
13namespace flutter {
14
15class DirectoryAssetBundle : public AssetResolver {
16 public:
17 explicit DirectoryAssetBundle(fml::UniqueFD descriptor);
18
19 ~DirectoryAssetBundle() override;
20
21 private:
22 const fml::UniqueFD descriptor_;
23 bool is_valid_ = false;
24
25 // |AssetResolver|
26 bool IsValid() const override;
27
28 // |AssetResolver|
29 std::unique_ptr<fml::Mapping> GetAsMapping(
30 const std::string& asset_name) const override;
31
32 FML_DISALLOW_COPY_AND_ASSIGN(DirectoryAssetBundle);
33};
34
35} // namespace flutter
36
37#endif // FLUTTER_ASSETS_DIRECTORY_ASSET_BUNDLE_H_
38