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

Side by Side Diff: mojo/services/catalog/catalog.h

Issue 1828733004: Load application manifests from resources (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 unified diff | Download patch
« no previous file with comments | « mojo/services/catalog/BUILD.gn ('k') | mojo/services/catalog/catalog.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MOJO_SERVICES_CATALOG_CATALOG_H_ 5 #ifndef MOJO_SERVICES_CATALOG_CATALOG_H_
6 #define MOJO_SERVICES_CATALOG_CATALOG_H_ 6 #define MOJO_SERVICES_CATALOG_CATALOG_H_
7 7
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "mojo/public/cpp/bindings/binding_set.h" 12 #include "mojo/public/cpp/bindings/binding_set.h"
13 #include "mojo/services/catalog/entry.h" 13 #include "mojo/services/catalog/entry.h"
14 #include "mojo/services/catalog/public/interfaces/catalog.mojom.h" 14 #include "mojo/services/catalog/public/interfaces/catalog.mojom.h"
15 #include "mojo/services/catalog/public/interfaces/resolver.mojom.h" 15 #include "mojo/services/catalog/public/interfaces/resolver.mojom.h"
16 #include "mojo/services/catalog/store.h" 16 #include "mojo/services/catalog/store.h"
17 #include "mojo/services/catalog/types.h" 17 #include "mojo/services/catalog/types.h"
18 #include "mojo/shell/public/cpp/interface_factory.h" 18 #include "mojo/shell/public/cpp/interface_factory.h"
19 #include "mojo/shell/public/interfaces/shell_resolver.mojom.h" 19 #include "mojo/shell/public/interfaces/shell_resolver.mojom.h"
20 20
21 namespace catalog { 21 namespace catalog {
22 22
23 class ManifestProvider;
23 class Store; 24 class Store;
24 25
25 struct ReadManifestResult { 26 struct ReadManifestResult {
26 ReadManifestResult(); 27 ReadManifestResult();
27 ~ReadManifestResult(); 28 ~ReadManifestResult();
28 scoped_ptr<base::Value> manifest_root; 29 mojo::shell::mojom::ResolveResultPtr resolve_result;
30 scoped_ptr<Entry> catalog_entry;
29 base::FilePath package_dir; 31 base::FilePath package_dir;
30 }; 32 };
31 33
32 class Catalog : public mojom::Resolver, 34 class Catalog : public mojom::Resolver,
33 public mojo::shell::mojom::ShellResolver, 35 public mojo::shell::mojom::ShellResolver,
34 public mojom::Catalog { 36 public mojom::Catalog {
35 public: 37 public:
38 // |manifest_provider| may be null.
36 Catalog(scoped_ptr<Store> store, 39 Catalog(scoped_ptr<Store> store,
37 base::TaskRunner* file_task_runner, 40 base::TaskRunner* file_task_runner,
38 EntryCache* system_catalog); 41 EntryCache* system_catalog,
42 ManifestProvider* manifest_provider);
39 ~Catalog() override; 43 ~Catalog() override;
40 44
41 void BindResolver(mojom::ResolverRequest request); 45 void BindResolver(mojom::ResolverRequest request);
42 void BindShellResolver(mojo::shell::mojom::ShellResolverRequest request); 46 void BindShellResolver(mojo::shell::mojom::ShellResolverRequest request);
43 void BindCatalog(mojom::CatalogRequest request); 47 void BindCatalog(mojom::CatalogRequest request);
44 48
45 private: 49 private:
46 using MojoNameAliasMap = 50 using MojoNameAliasMap =
47 std::map<std::string, std::pair<std::string, std::string>>; 51 std::map<std::string, std::pair<std::string, std::string>>;
48 52
(...skipping 25 matching lines...) Expand all
74 // received after the catalog object that issued the request is destroyed. 78 // received after the catalog object that issued the request is destroyed.
75 static void OnReadManifest(base::WeakPtr<Catalog> catalog, 79 static void OnReadManifest(base::WeakPtr<Catalog> catalog,
76 const std::string& name, 80 const std::string& name,
77 const ResolveMojoNameCallback& callback, 81 const ResolveMojoNameCallback& callback,
78 scoped_ptr<ReadManifestResult> result); 82 scoped_ptr<ReadManifestResult> result);
79 83
80 // Populate the catalog with data from |entry|, and pass it to the client 84 // Populate the catalog with data from |entry|, and pass it to the client
81 // via callback. 85 // via callback.
82 void AddEntryToCatalog(scoped_ptr<Entry> entry, bool is_system_catalog); 86 void AddEntryToCatalog(scoped_ptr<Entry> entry, bool is_system_catalog);
83 87
88 ManifestProvider* const manifest_provider_;
89
84 // Directory that contains packages and executables visible to all users. 90 // Directory that contains packages and executables visible to all users.
85 base::FilePath system_package_dir_; 91 base::FilePath system_package_dir_;
86 // Directory that contains packages visible to this Catalog instance's user. 92 // Directory that contains packages visible to this Catalog instance's user.
87 base::FilePath user_package_dir_; 93 base::FilePath user_package_dir_;
88 94
89 // User-specific persistent storage of package manifests and other settings. 95 // User-specific persistent storage of package manifests and other settings.
90 scoped_ptr<Store> store_; 96 scoped_ptr<Store> store_;
91 97
92 // Task runner for performing file operations. 98 // Task runner for performing file operations.
93 base::TaskRunner* file_task_runner_; 99 base::TaskRunner* const file_task_runner_;
94 100
95 mojo::BindingSet<mojom::Resolver> resolver_bindings_; 101 mojo::BindingSet<mojom::Resolver> resolver_bindings_;
96 mojo::BindingSet<mojo::shell::mojom::ShellResolver> shell_resolver_bindings_; 102 mojo::BindingSet<mojo::shell::mojom::ShellResolver> shell_resolver_bindings_;
97 mojo::BindingSet<mojom::Catalog> catalog_bindings_; 103 mojo::BindingSet<mojom::Catalog> catalog_bindings_;
98 104
99 // The current user's packages, constructed from Store/package manifests. 105 // The current user's packages, constructed from Store/package manifests.
100 EntryCache user_catalog_; 106 EntryCache user_catalog_;
101 // Same as above, but for system-level (visible to all-users) packages and 107 // Same as above, but for system-level (visible to all-users) packages and
102 // executables. 108 // executables.
103 EntryCache* system_catalog_; 109 EntryCache* system_catalog_;
104 110
105 base::WeakPtrFactory<Catalog> weak_factory_; 111 base::WeakPtrFactory<Catalog> weak_factory_;
106 112
107 DISALLOW_COPY_AND_ASSIGN(Catalog); 113 DISALLOW_COPY_AND_ASSIGN(Catalog);
108 }; 114 };
109 115
110 } // namespace catalog 116 } // namespace catalog
111 117
112 #endif // MOJO_SERVICES_CATALOG_CATALOG_H_ 118 #endif // MOJO_SERVICES_CATALOG_CATALOG_H_
OLDNEW
« no previous file with comments | « mojo/services/catalog/BUILD.gn ('k') | mojo/services/catalog/catalog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698