Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Unified Diff: services/catalog/public/cpp/resource_loader.h

Issue 1942473002: Eliminate mojo:resource_provider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698