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