OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium 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 SERVICES_CATALOG_PUBLIC_CPP_RESOURCE_LOADER_H_ |
| 6 #define SERVICES_CATALOG_PUBLIC_CPP_RESOURCE_LOADER_H_ |
| 7 |
| 8 #include <map> |
| 9 #include <memory> |
| 10 #include <set> |
| 11 #include <string> |
| 12 |
| 13 #include "base/macros.h" |
| 14 |
| 15 namespace base { |
| 16 class File; |
| 17 } |
| 18 |
| 19 namespace shell { |
| 20 class Connector; |
| 21 } |
| 22 |
| 23 namespace catalog { |
| 24 |
| 25 // ResourceLoader asks the catalog (synchronously) to open the provided paths |
| 26 // and return the file handles. Use TakeFile() to retrieve a base::File to use |
| 27 // in client code. |
| 28 class ResourceLoader { |
| 29 public: |
| 30 ResourceLoader(shell::Connector* connector, |
| 31 const std::set<std::string>& paths); |
| 32 ~ResourceLoader(); |
| 33 |
| 34 // Releases and returns the file wrapping the handle. |
| 35 base::File TakeFile(const std::string& path); |
| 36 |
| 37 private: |
| 38 using ResourceMap = std::map<std::string, std::unique_ptr<base::File>>; |
| 39 |
| 40 ResourceMap resource_map_; |
| 41 |
| 42 DISALLOW_COPY_AND_ASSIGN(ResourceLoader); |
| 43 }; |
| 44 |
| 45 } // namespace |
| 46 |
| 47 #endif // SERVICES_CATALOG_PUBLIC_CPP_RESOURCE_LOADER_H_ |
OLD | NEW |