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

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, 7 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
« no previous file with comments | « services/catalog/public/cpp/BUILD.gn ('k') | services/catalog/public/cpp/resource_loader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..1d6033c6e6c0f0f26e9b4002813a575ccd3f08a3
--- /dev/null
+++ b/services/catalog/public/cpp/resource_loader.h
@@ -0,0 +1,49 @@
+// 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"
+#include "components/filesystem/public/interfaces/directory.mojom.h"
+
+namespace base {
+class File;
+}
+
+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();
+ ~ResourceLoader();
+
+ // (Synchronously) opens all of the files in |paths| for reading. Use
+ // TakeFile() subsequently to obtain base::Files to use. Returns true if the
+ // sync operation completed, false if it did not.
+ bool OpenFiles(filesystem::DirectoryPtr directory,
+ const std::set<std::string>& paths);
+
+ // 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_
« no previous file with comments | « services/catalog/public/cpp/BUILD.gn ('k') | services/catalog/public/cpp/resource_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698