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

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

Issue 2420253002: Rename shell namespace to service_manager (Closed)
Patch Set: . Created 4 years, 2 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/entry_unittest.cc ('k') | services/catalog/instance.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 SERVICES_CATALOG_INSTANCE_H_ 5 #ifndef SERVICES_CATALOG_INSTANCE_H_
6 #define SERVICES_CATALOG_INSTANCE_H_ 6 #define SERVICES_CATALOG_INSTANCE_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 "services/catalog/entry.h" 13 #include "services/catalog/entry.h"
14 #include "services/catalog/public/interfaces/catalog.mojom.h" 14 #include "services/catalog/public/interfaces/catalog.mojom.h"
15 #include "services/catalog/store.h" 15 #include "services/catalog/store.h"
16 #include "services/catalog/types.h" 16 #include "services/catalog/types.h"
17 #include "services/service_manager/public/cpp/interface_factory.h" 17 #include "services/service_manager/public/cpp/interface_factory.h"
18 #include "services/service_manager/public/interfaces/resolver.mojom.h" 18 #include "services/service_manager/public/interfaces/resolver.mojom.h"
19 19
20 namespace catalog { 20 namespace catalog {
21 21
22 class Reader; 22 class Reader;
23 class Store; 23 class Store;
24 24
25 class Instance : public shell::mojom::Resolver, 25 class Instance : public service_manager::mojom::Resolver,
26 public mojom::Catalog { 26 public mojom::Catalog {
27 public: 27 public:
28 // |manifest_provider| may be null. 28 // |manifest_provider| may be null.
29 Instance(std::unique_ptr<Store> store, Reader* system_reader); 29 Instance(std::unique_ptr<Store> store, Reader* system_reader);
30 ~Instance() override; 30 ~Instance() override;
31 31
32 void BindResolver(shell::mojom::ResolverRequest request); 32 void BindResolver(service_manager::mojom::ResolverRequest request);
33 void BindCatalog(mojom::CatalogRequest request); 33 void BindCatalog(mojom::CatalogRequest request);
34 34
35 // Called when |cache| has been populated by a directory scan. 35 // Called when |cache| has been populated by a directory scan.
36 void CacheReady(EntryCache* cache); 36 void CacheReady(EntryCache* cache);
37 37
38 private: 38 private:
39 // shell::mojom::Resolver: 39 // service_manager::mojom::Resolver:
40 void ResolveMojoName(const std::string& mojo_name, 40 void ResolveMojoName(const std::string& mojo_name,
41 const ResolveMojoNameCallback& callback) override; 41 const ResolveMojoNameCallback& callback) override;
42 42
43 // mojom::Catalog: 43 // mojom::Catalog:
44 void GetEntries(const base::Optional<std::vector<std::string>>& names, 44 void GetEntries(const base::Optional<std::vector<std::string>>& names,
45 const GetEntriesCallback& callback) override; 45 const GetEntriesCallback& callback) override;
46 void GetEntriesProvidingClass( 46 void GetEntriesProvidingClass(
47 const std::string& clazz, 47 const std::string& clazz,
48 const GetEntriesProvidingClassCallback& callback) override; 48 const GetEntriesProvidingClassCallback& callback) override;
49 void GetEntriesConsumingMIMEType( 49 void GetEntriesConsumingMIMEType(
50 const std::string& mime_type, 50 const std::string& mime_type,
51 const GetEntriesConsumingMIMETypeCallback& callback) override; 51 const GetEntriesConsumingMIMETypeCallback& callback) override;
52 void GetEntriesSupportingScheme( 52 void GetEntriesSupportingScheme(
53 const std::string& scheme, 53 const std::string& scheme,
54 const GetEntriesSupportingSchemeCallback& callback) override; 54 const GetEntriesSupportingSchemeCallback& callback) override;
55 55
56 // Populate/serialize the cache from/to the supplied store. 56 // Populate/serialize the cache from/to the supplied store.
57 void DeserializeCatalog(); 57 void DeserializeCatalog();
58 void SerializeCatalog(); 58 void SerializeCatalog();
59 59
60 // Receives the result of manifest parsing, may be received after the 60 // Receives the result of manifest parsing, may be received after the
61 // catalog object that issued the request is destroyed. 61 // catalog object that issued the request is destroyed.
62 static void OnReadManifest(base::WeakPtr<Instance> instance, 62 static void OnReadManifest(base::WeakPtr<Instance> instance,
63 const std::string& mojo_name, 63 const std::string& mojo_name,
64 const ResolveMojoNameCallback& callback, 64 const ResolveMojoNameCallback& callback,
65 shell::mojom::ResolveResultPtr result); 65 service_manager::mojom::ResolveResultPtr result);
66 66
67 // User-specific persistent storage of package manifests and other settings. 67 // User-specific persistent storage of package manifests and other settings.
68 std::unique_ptr<Store> store_; 68 std::unique_ptr<Store> store_;
69 69
70 mojo::BindingSet<shell::mojom::Resolver> resolver_bindings_; 70 mojo::BindingSet<service_manager::mojom::Resolver> resolver_bindings_;
71 mojo::BindingSet<mojom::Catalog> catalog_bindings_; 71 mojo::BindingSet<mojom::Catalog> catalog_bindings_;
72 72
73 Reader* system_reader_; 73 Reader* system_reader_;
74 74
75 // A map of name -> Entry data structure for system-level packages (i.e. those 75 // A map of name -> Entry data structure for system-level packages (i.e. those
76 // that are visible to all users). 76 // that are visible to all users).
77 // TODO(beng): eventually add per-user applications. 77 // TODO(beng): eventually add per-user applications.
78 EntryCache* system_cache_ = nullptr; 78 EntryCache* system_cache_ = nullptr;
79 79
80 // We only bind requests for these interfaces once the catalog has been 80 // We only bind requests for these interfaces once the catalog has been
81 // populated. These data structures queue requests until that happens. 81 // populated. These data structures queue requests until that happens.
82 std::vector<shell::mojom::ResolverRequest> pending_resolver_requests_; 82 std::vector<service_manager::mojom::ResolverRequest>
83 pending_resolver_requests_;
83 std::vector<mojom::CatalogRequest> pending_catalog_requests_; 84 std::vector<mojom::CatalogRequest> pending_catalog_requests_;
84 85
85 base::WeakPtrFactory<Instance> weak_factory_; 86 base::WeakPtrFactory<Instance> weak_factory_;
86 87
87 DISALLOW_COPY_AND_ASSIGN(Instance); 88 DISALLOW_COPY_AND_ASSIGN(Instance);
88 }; 89 };
89 90
90 } // namespace catalog 91 } // namespace catalog
91 92
92 #endif // SERVICES_CATALOG_INSTANCE_H_ 93 #endif // SERVICES_CATALOG_INSTANCE_H_
OLDNEW
« no previous file with comments | « services/catalog/entry_unittest.cc ('k') | services/catalog/instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698