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 "mojo/public/cpp/bindings/binding.h" | 15 #include "mojo/public/cpp/bindings/binding.h" |
15 #include "services/catalog/public/interfaces/catalog.mojom.h" | 16 #include "services/catalog/public/interfaces/catalog.mojom.h" |
16 #include "services/catalog/types.h" | 17 #include "services/catalog/types.h" |
17 #include "services/shell/public/cpp/shell_client.h" | 18 #include "services/shell/public/cpp/shell_client.h" |
18 #include "services/shell/public/interfaces/shell_client.mojom.h" | 19 #include "services/shell/public/interfaces/shell_client.mojom.h" |
19 #include "services/shell/public/interfaces/shell_resolver.mojom.h" | 20 #include "services/shell/public/interfaces/shell_resolver.mojom.h" |
20 | 21 |
21 namespace base { | 22 namespace base { |
22 class SequencedWorkerPool; | 23 class SequencedWorkerPool; |
23 class SingleThreadTaskRunner; | 24 class SingleThreadTaskRunner; |
24 } | 25 } |
25 | 26 |
| 27 namespace filesystem { |
| 28 class LockTable; |
| 29 } |
| 30 |
26 namespace shell { | 31 namespace shell { |
27 class ShellConnection; | 32 class ShellConnection; |
28 } | 33 } |
29 | 34 |
30 namespace catalog { | 35 namespace catalog { |
31 | 36 |
32 class Instance; | 37 class Instance; |
33 class ManifestProvider; | 38 class ManifestProvider; |
34 class Reader; | 39 class Reader; |
35 class Store; | 40 class Store; |
36 | 41 |
37 // Creates and owns an instance of the catalog. Exposes a ShellClientPtr that | 42 // Creates and owns an instance of the catalog. Exposes a ShellClientPtr that |
38 // can be passed to the Shell, potentially in a different process. | 43 // can be passed to the Shell, potentially in a different process. |
39 class Catalog : public shell::ShellClient, | 44 class Catalog : public shell::ShellClient, |
40 public shell::InterfaceFactory<mojom::Catalog>, | 45 public shell::InterfaceFactory<mojom::Catalog>, |
| 46 public shell::InterfaceFactory<filesystem::Directory>, |
41 public shell::InterfaceFactory<shell::mojom::ShellResolver> { | 47 public shell::InterfaceFactory<shell::mojom::ShellResolver> { |
42 public: | 48 public: |
43 // |manifest_provider| may be null. | 49 // |manifest_provider| may be null. |
44 Catalog(base::SequencedWorkerPool* worker_pool, | 50 Catalog(base::SequencedWorkerPool* worker_pool, |
45 std::unique_ptr<Store> store, | 51 std::unique_ptr<Store> store, |
46 ManifestProvider* manifest_provider); | 52 ManifestProvider* manifest_provider); |
47 Catalog(base::SingleThreadTaskRunner* task_runner, | 53 Catalog(base::SingleThreadTaskRunner* task_runner, |
48 std::unique_ptr<Store> store, | 54 std::unique_ptr<Store> store, |
49 ManifestProvider* manifest_provider); | 55 ManifestProvider* manifest_provider); |
50 ~Catalog() override; | 56 ~Catalog() override; |
(...skipping 10 matching lines...) Expand all Loading... |
61 bool AcceptConnection(shell::Connection* connection) override; | 67 bool AcceptConnection(shell::Connection* connection) override; |
62 | 68 |
63 // shell::InterfaceFactory<shell::mojom::ShellResolver>: | 69 // shell::InterfaceFactory<shell::mojom::ShellResolver>: |
64 void Create(shell::Connection* connection, | 70 void Create(shell::Connection* connection, |
65 shell::mojom::ShellResolverRequest request) override; | 71 shell::mojom::ShellResolverRequest request) override; |
66 | 72 |
67 // shell::InterfaceFactory<mojom::Catalog>: | 73 // shell::InterfaceFactory<mojom::Catalog>: |
68 void Create(shell::Connection* connection, | 74 void Create(shell::Connection* connection, |
69 mojom::CatalogRequest request) override; | 75 mojom::CatalogRequest request) override; |
70 | 76 |
| 77 // shell::InterfaceFactory<filesystem::Directory>: |
| 78 void Create(shell::Connection* connection, |
| 79 filesystem::DirectoryRequest request) override; |
| 80 |
71 Instance* GetInstanceForUserId(const std::string& user_id); | 81 Instance* GetInstanceForUserId(const std::string& user_id); |
72 | 82 |
73 void SystemPackageDirScanned(); | 83 void SystemPackageDirScanned(); |
74 | 84 |
75 std::unique_ptr<Store> store_; | 85 std::unique_ptr<Store> store_; |
76 | 86 |
77 shell::mojom::ShellClientPtr shell_client_; | 87 shell::mojom::ShellClientPtr shell_client_; |
78 std::unique_ptr<shell::ShellConnection> shell_connection_; | 88 std::unique_ptr<shell::ShellConnection> shell_connection_; |
79 | 89 |
80 std::map<std::string, std::unique_ptr<Instance>> instances_; | 90 std::map<std::string, std::unique_ptr<Instance>> instances_; |
81 | 91 |
82 std::unique_ptr<Reader> system_reader_; | 92 std::unique_ptr<Reader> system_reader_; |
83 EntryCache system_cache_; | 93 EntryCache system_cache_; |
84 bool loaded_ = false; | 94 bool loaded_ = false; |
85 | 95 |
| 96 scoped_refptr<filesystem::LockTable> lock_table_; |
| 97 |
86 base::WeakPtrFactory<Catalog> weak_factory_; | 98 base::WeakPtrFactory<Catalog> weak_factory_; |
87 | 99 |
88 DISALLOW_COPY_AND_ASSIGN(Catalog); | 100 DISALLOW_COPY_AND_ASSIGN(Catalog); |
89 }; | 101 }; |
90 | 102 |
91 } // namespace catalog | 103 } // namespace catalog |
92 | 104 |
93 #endif // SERVICES_CATALOG_CATALOG_H_ | 105 #endif // SERVICES_CATALOG_CATALOG_H_ |
OLD | NEW |