| 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 MOJO_SERVICES_CATALOG_FACTORY_H_ | 5 #ifndef MOJO_SERVICES_CATALOG_FACTORY_H_ |
| 6 #define MOJO_SERVICES_CATALOG_FACTORY_H_ | 6 #define MOJO_SERVICES_CATALOG_FACTORY_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 class TaskRunner; | 23 class TaskRunner; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace mojo{ | 26 namespace mojo{ |
| 27 class ShellConnection; | 27 class ShellConnection; |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace catalog { | 30 namespace catalog { |
| 31 | 31 |
| 32 class Catalog; | 32 class Catalog; |
| 33 class ManifestProvider; |
| 33 class Store; | 34 class Store; |
| 34 | 35 |
| 35 // Creates and owns an instance of the catalog. Exposes a ShellClientPtr that | 36 // Creates and owns an instance of the catalog. Exposes a ShellClientPtr that |
| 36 // can be passed to the Shell, potentially in a different process. | 37 // can be passed to the Shell, potentially in a different process. |
| 37 class Factory | 38 class Factory |
| 38 : public mojo::ShellClient, | 39 : public mojo::ShellClient, |
| 39 public mojo::InterfaceFactory<mojom::Catalog>, | 40 public mojo::InterfaceFactory<mojom::Catalog>, |
| 40 public mojo::InterfaceFactory<mojom::Resolver>, | 41 public mojo::InterfaceFactory<mojom::Resolver>, |
| 41 public mojo::InterfaceFactory<mojo::shell::mojom::ShellResolver> { | 42 public mojo::InterfaceFactory<mojo::shell::mojom::ShellResolver> { |
| 42 public: | 43 public: |
| 43 Factory(base::TaskRunner* file_task_runner, scoped_ptr<Store> store); | 44 // |manifest_provider| may be null. |
| 45 Factory(base::TaskRunner* file_task_runner, |
| 46 scoped_ptr<Store> store, |
| 47 ManifestProvider* manifest_provider); |
| 44 ~Factory() override; | 48 ~Factory() override; |
| 45 | 49 |
| 46 mojo::shell::mojom::ShellClientPtr TakeShellClient(); | 50 mojo::shell::mojom::ShellClientPtr TakeShellClient(); |
| 47 | 51 |
| 48 private: | 52 private: |
| 49 // mojo::ShellClient: | 53 // mojo::ShellClient: |
| 50 bool AcceptConnection(mojo::Connection* connection) override; | 54 bool AcceptConnection(mojo::Connection* connection) override; |
| 51 | 55 |
| 52 // mojo::InterfaceFactory<mojom::Resolver>: | 56 // mojo::InterfaceFactory<mojom::Resolver>: |
| 53 void Create(mojo::Connection* connection, | 57 void Create(mojo::Connection* connection, |
| 54 mojom::ResolverRequest request) override; | 58 mojom::ResolverRequest request) override; |
| 55 | 59 |
| 56 // mojo::InterfaceFactory<mojo::shell::mojom::ShellResolver>: | 60 // mojo::InterfaceFactory<mojo::shell::mojom::ShellResolver>: |
| 57 void Create(mojo::Connection* connection, | 61 void Create(mojo::Connection* connection, |
| 58 mojo::shell::mojom::ShellResolverRequest request) override; | 62 mojo::shell::mojom::ShellResolverRequest request) override; |
| 59 | 63 |
| 60 // mojo::InterfaceFactory<mojom::Catalog>: | 64 // mojo::InterfaceFactory<mojom::Catalog>: |
| 61 void Create(mojo::Connection* connection, | 65 void Create(mojo::Connection* connection, |
| 62 mojom::CatalogRequest request) override; | 66 mojom::CatalogRequest request) override; |
| 63 | 67 |
| 64 Catalog* GetCatalogForUserId(const std::string& user_id); | 68 Catalog* GetCatalogForUserId(const std::string& user_id); |
| 65 | 69 |
| 66 base::TaskRunner* file_task_runner_; | 70 base::TaskRunner* const file_task_runner_; |
| 67 scoped_ptr<Store> store_; | 71 scoped_ptr<Store> store_; |
| 72 ManifestProvider* const manifest_provider_; |
| 68 | 73 |
| 69 mojo::shell::mojom::ShellClientPtr shell_client_; | 74 mojo::shell::mojom::ShellClientPtr shell_client_; |
| 70 scoped_ptr<mojo::ShellConnection> shell_connection_; | 75 scoped_ptr<mojo::ShellConnection> shell_connection_; |
| 71 | 76 |
| 72 std::map<std::string, scoped_ptr<Catalog>> catalogs_; | 77 std::map<std::string, scoped_ptr<Catalog>> catalogs_; |
| 73 | 78 |
| 74 EntryCache system_catalog_; | 79 EntryCache system_catalog_; |
| 75 | 80 |
| 76 base::WeakPtrFactory<Factory> weak_factory_; | 81 base::WeakPtrFactory<Factory> weak_factory_; |
| 77 | 82 |
| 78 DISALLOW_COPY_AND_ASSIGN(Factory); | 83 DISALLOW_COPY_AND_ASSIGN(Factory); |
| 79 }; | 84 }; |
| 80 | 85 |
| 81 } // namespace catalog | 86 } // namespace catalog |
| 82 | 87 |
| 83 #endif // MOJO_SERVICES_CATALOG_FACTORY_H_ | 88 #endif // MOJO_SERVICES_CATALOG_FACTORY_H_ |
| OLD | NEW |