Index: services/catalog/public/cpp/resource_loader.h |
diff --git a/services/catalog/public/cpp/resource_loader.h b/services/catalog/public/cpp/resource_loader.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..552d68dcbe8d2cb8c9a7a5ca16ebcbae90d3d9d4 |
--- /dev/null |
+++ b/services/catalog/public/cpp/resource_loader.h |
@@ -0,0 +1,47 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef SERVICES_CATALOG_PUBLIC_CPP_RESOURCE_LOADER_H_ |
+#define SERVICES_CATALOG_PUBLIC_CPP_RESOURCE_LOADER_H_ |
+ |
+#include <map> |
+#include <memory> |
+#include <set> |
+#include <string> |
+ |
+#include "base/macros.h" |
+ |
+namespace base { |
+class File; |
+} |
+ |
+namespace shell { |
+class Connector; |
+} |
+ |
+namespace catalog { |
+ |
+// ResourceLoader asks the catalog (synchronously) to open the provided paths |
+// and return the file handles. Use TakeFile() to retrieve a base::File to use |
+// in client code. |
+class ResourceLoader { |
+ public: |
+ ResourceLoader(shell::Connector* connector, |
+ const std::set<std::string>& paths); |
+ ~ResourceLoader(); |
+ |
+ // Releases and returns the file wrapping the handle. |
+ base::File TakeFile(const std::string& path); |
+ |
+ private: |
+ using ResourceMap = std::map<std::string, std::unique_ptr<base::File>>; |
+ |
+ ResourceMap resource_map_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ResourceLoader); |
+}; |
+ |
+} // namespace |
+ |
+#endif // SERVICES_CATALOG_PUBLIC_CPP_RESOURCE_LOADER_H_ |