OLD | NEW |
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_CATALOG_H_ | 5 #ifndef SERVICES_CATALOG_CATALOG_H_ |
6 #define SERVICES_CATALOG_CATALOG_H_ | 6 #define SERVICES_CATALOG_CATALOG_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "components/filesystem/public/interfaces/directory.mojom.h" | 14 #include "components/filesystem/public/interfaces/directory.mojom.h" |
15 #include "mojo/public/cpp/bindings/binding.h" | 15 #include "mojo/public/cpp/bindings/binding.h" |
| 16 #include "mojo/public/cpp/bindings/binding_set.h" |
16 #include "services/catalog/public/interfaces/catalog.mojom.h" | 17 #include "services/catalog/public/interfaces/catalog.mojom.h" |
17 #include "services/catalog/types.h" | 18 #include "services/catalog/types.h" |
18 #include "services/shell/public/cpp/service.h" | 19 #include "services/shell/public/cpp/service.h" |
19 #include "services/shell/public/interfaces/resolver.mojom.h" | 20 #include "services/shell/public/interfaces/resolver.mojom.h" |
20 #include "services/shell/public/interfaces/service.mojom.h" | 21 #include "services/shell/public/interfaces/service.mojom.h" |
21 | 22 |
22 namespace base { | 23 namespace base { |
23 class SequencedWorkerPool; | 24 class SequencedWorkerPool; |
24 class SingleThreadTaskRunner; | 25 class SingleThreadTaskRunner; |
25 } | 26 } |
(...skipping 11 matching lines...) Expand all Loading... |
37 class Instance; | 38 class Instance; |
38 class ManifestProvider; | 39 class ManifestProvider; |
39 class Reader; | 40 class Reader; |
40 class Store; | 41 class Store; |
41 | 42 |
42 // Creates and owns an instance of the catalog. Exposes a ServicePtr that | 43 // Creates and owns an instance of the catalog. Exposes a ServicePtr that |
43 // can be passed to the Shell, potentially in a different process. | 44 // can be passed to the Shell, potentially in a different process. |
44 class Catalog : public shell::Service, | 45 class Catalog : public shell::Service, |
45 public shell::InterfaceFactory<mojom::Catalog>, | 46 public shell::InterfaceFactory<mojom::Catalog>, |
46 public shell::InterfaceFactory<filesystem::mojom::Directory>, | 47 public shell::InterfaceFactory<filesystem::mojom::Directory>, |
47 public shell::InterfaceFactory<shell::mojom::Resolver> { | 48 public shell::InterfaceFactory<shell::mojom::Resolver>, |
| 49 public shell::InterfaceFactory<mojom::CatalogControl>, |
| 50 public mojom::CatalogControl { |
48 public: | 51 public: |
49 // |manifest_provider| may be null. | 52 // |manifest_provider| may be null. |
50 Catalog(base::SequencedWorkerPool* worker_pool, | 53 Catalog(base::SequencedWorkerPool* worker_pool, |
51 std::unique_ptr<Store> store, | 54 std::unique_ptr<Store> store, |
52 ManifestProvider* manifest_provider); | 55 ManifestProvider* manifest_provider); |
53 Catalog(base::SingleThreadTaskRunner* task_runner, | 56 Catalog(base::SingleThreadTaskRunner* task_runner, |
54 std::unique_ptr<Store> store, | 57 std::unique_ptr<Store> store, |
55 ManifestProvider* manifest_provider); | 58 ManifestProvider* manifest_provider); |
56 ~Catalog() override; | 59 ~Catalog() override; |
57 | 60 |
(...skipping 14 matching lines...) Expand all Loading... |
72 shell::mojom::ResolverRequest request) override; | 75 shell::mojom::ResolverRequest request) override; |
73 | 76 |
74 // shell::InterfaceFactory<mojom::Catalog>: | 77 // shell::InterfaceFactory<mojom::Catalog>: |
75 void Create(const shell::Identity& remote_identity, | 78 void Create(const shell::Identity& remote_identity, |
76 mojom::CatalogRequest request) override; | 79 mojom::CatalogRequest request) override; |
77 | 80 |
78 // shell::InterfaceFactory<filesystem::mojom::Directory>: | 81 // shell::InterfaceFactory<filesystem::mojom::Directory>: |
79 void Create(const shell::Identity& remote_identity, | 82 void Create(const shell::Identity& remote_identity, |
80 filesystem::mojom::DirectoryRequest request) override; | 83 filesystem::mojom::DirectoryRequest request) override; |
81 | 84 |
| 85 // shell::InterfaceFactory<mojom::CatalogControl>: |
| 86 void Create(const shell::Identity& remote_identity, |
| 87 mojom::CatalogControlRequest request) override; |
| 88 |
| 89 // mojom::CatalogControl: |
| 90 void OverrideManifestPath( |
| 91 const std::string& service_name, |
| 92 const base::FilePath& path, |
| 93 const OverrideManifestPathCallback& callback) override; |
| 94 |
82 Instance* GetInstanceForUserId(const std::string& user_id); | 95 Instance* GetInstanceForUserId(const std::string& user_id); |
83 | 96 |
84 void SystemPackageDirScanned(); | 97 void SystemPackageDirScanned(); |
85 | 98 |
86 std::unique_ptr<Store> store_; | 99 std::unique_ptr<Store> store_; |
87 | 100 |
88 shell::mojom::ServicePtr service_; | 101 shell::mojom::ServicePtr service_; |
89 std::unique_ptr<shell::ServiceContext> shell_connection_; | 102 std::unique_ptr<shell::ServiceContext> shell_connection_; |
90 | 103 |
91 std::map<std::string, std::unique_ptr<Instance>> instances_; | 104 std::map<std::string, std::unique_ptr<Instance>> instances_; |
92 | 105 |
93 std::unique_ptr<Reader> system_reader_; | 106 std::unique_ptr<Reader> system_reader_; |
94 EntryCache system_cache_; | 107 EntryCache system_cache_; |
95 bool loaded_ = false; | 108 bool loaded_ = false; |
96 | 109 |
97 scoped_refptr<filesystem::LockTable> lock_table_; | 110 scoped_refptr<filesystem::LockTable> lock_table_; |
98 | 111 |
| 112 mojo::BindingSet<mojom::CatalogControl> control_bindings_; |
| 113 |
99 base::WeakPtrFactory<Catalog> weak_factory_; | 114 base::WeakPtrFactory<Catalog> weak_factory_; |
100 | 115 |
101 DISALLOW_COPY_AND_ASSIGN(Catalog); | 116 DISALLOW_COPY_AND_ASSIGN(Catalog); |
102 }; | 117 }; |
103 | 118 |
104 } // namespace catalog | 119 } // namespace catalog |
105 | 120 |
106 #endif // SERVICES_CATALOG_CATALOG_H_ | 121 #endif // SERVICES_CATALOG_CATALOG_H_ |
OLD | NEW |