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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 #include "components/filesystem/public/interfaces/directory.mojom.h"
15
16 namespace base {
17 class File;
18 }
19
20 namespace catalog {
21
22 // ResourceLoader asks the catalog (synchronously) to open the provided paths
23 // and return the file handles. Use TakeFile() to retrieve a base::File to use
24 // in client code.
25 class ResourceLoader {
26 public:
27 ResourceLoader();
28 ~ResourceLoader();
29
30 // (Synchronously) opens all of the files in |paths| for reading. Use
31 // TakeFile() subsequently to obtain base::Files to use. Returns true if the
32 // sync operation completed, false if it did not.
33 bool OpenFiles(filesystem::DirectoryPtr directory,
34 const std::set<std::string>& paths);
35
36 // Releases and returns the file wrapping the handle.
37 base::File TakeFile(const std::string& path);
38
39 private:
40 using ResourceMap = std::map<std::string, std::unique_ptr<base::File>>;
41
42 ResourceMap resource_map_;
43
44 DISALLOW_COPY_AND_ASSIGN(ResourceLoader);
45 };
46
47 } // namespace
48
49 #endif // SERVICES_CATALOG_PUBLIC_CPP_RESOURCE_LOADER_H_
OLDNEW
« 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