| 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 <string> | 10 #include <string> |
| 10 | 11 |
| 11 #include "base/macros.h" | 12 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "mojo/public/cpp/bindings/binding.h" | 14 #include "mojo/public/cpp/bindings/binding.h" |
| 15 #include "services/catalog/public/interfaces/catalog.mojom.h" | 15 #include "services/catalog/public/interfaces/catalog.mojom.h" |
| 16 #include "services/catalog/types.h" | 16 #include "services/catalog/types.h" |
| 17 #include "services/shell/public/cpp/shell_client.h" | 17 #include "services/shell/public/cpp/shell_client.h" |
| 18 #include "services/shell/public/interfaces/shell_client.mojom.h" | 18 #include "services/shell/public/interfaces/shell_client.mojom.h" |
| 19 #include "services/shell/public/interfaces/shell_resolver.mojom.h" | 19 #include "services/shell/public/interfaces/shell_resolver.mojom.h" |
| 20 | 20 |
| 21 namespace base { | 21 namespace base { |
| 22 class TaskRunner; | 22 class TaskRunner; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 34 class Store; | 34 class Store; |
| 35 | 35 |
| 36 // 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 |
| 37 // can be passed to the Shell, potentially in a different process. | 37 // can be passed to the Shell, potentially in a different process. |
| 38 class Catalog : public shell::ShellClient, | 38 class Catalog : public shell::ShellClient, |
| 39 public shell::InterfaceFactory<mojom::Catalog>, | 39 public shell::InterfaceFactory<mojom::Catalog>, |
| 40 public shell::InterfaceFactory<shell::mojom::ShellResolver> { | 40 public shell::InterfaceFactory<shell::mojom::ShellResolver> { |
| 41 public: | 41 public: |
| 42 // |manifest_provider| may be null. | 42 // |manifest_provider| may be null. |
| 43 Catalog(base::TaskRunner* file_task_runner, | 43 Catalog(base::TaskRunner* file_task_runner, |
| 44 scoped_ptr<Store> store, | 44 std::unique_ptr<Store> store, |
| 45 ManifestProvider* manifest_provider); | 45 ManifestProvider* manifest_provider); |
| 46 ~Catalog() override; | 46 ~Catalog() override; |
| 47 | 47 |
| 48 shell::mojom::ShellClientPtr TakeShellClient(); | 48 shell::mojom::ShellClientPtr TakeShellClient(); |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 // shell::ShellClient: | 51 // shell::ShellClient: |
| 52 bool AcceptConnection(shell::Connection* connection) override; | 52 bool AcceptConnection(shell::Connection* connection) override; |
| 53 | 53 |
| 54 // shell::InterfaceFactory<shell::mojom::ShellResolver>: | 54 // shell::InterfaceFactory<shell::mojom::ShellResolver>: |
| 55 void Create(shell::Connection* connection, | 55 void Create(shell::Connection* connection, |
| 56 shell::mojom::ShellResolverRequest request) override; | 56 shell::mojom::ShellResolverRequest request) override; |
| 57 | 57 |
| 58 // shell::InterfaceFactory<mojom::Catalog>: | 58 // shell::InterfaceFactory<mojom::Catalog>: |
| 59 void Create(shell::Connection* connection, | 59 void Create(shell::Connection* connection, |
| 60 mojom::CatalogRequest request) override; | 60 mojom::CatalogRequest request) override; |
| 61 | 61 |
| 62 Instance* GetInstanceForUserId(const std::string& user_id); | 62 Instance* GetInstanceForUserId(const std::string& user_id); |
| 63 | 63 |
| 64 void SystemPackageDirScanned(); | 64 void SystemPackageDirScanned(); |
| 65 | 65 |
| 66 base::TaskRunner* const file_task_runner_; | 66 base::TaskRunner* const file_task_runner_; |
| 67 scoped_ptr<Store> store_; | 67 std::unique_ptr<Store> store_; |
| 68 | 68 |
| 69 shell::mojom::ShellClientPtr shell_client_; | 69 shell::mojom::ShellClientPtr shell_client_; |
| 70 scoped_ptr<shell::ShellConnection> shell_connection_; | 70 std::unique_ptr<shell::ShellConnection> shell_connection_; |
| 71 | 71 |
| 72 std::map<std::string, scoped_ptr<Instance>> instances_; | 72 std::map<std::string, std::unique_ptr<Instance>> instances_; |
| 73 | 73 |
| 74 scoped_ptr<Reader> system_reader_; | 74 std::unique_ptr<Reader> system_reader_; |
| 75 EntryCache system_cache_; | 75 EntryCache system_cache_; |
| 76 bool loaded_ = false; | 76 bool loaded_ = false; |
| 77 | 77 |
| 78 base::WeakPtrFactory<Catalog> weak_factory_; | 78 base::WeakPtrFactory<Catalog> weak_factory_; |
| 79 | 79 |
| 80 DISALLOW_COPY_AND_ASSIGN(Catalog); | 80 DISALLOW_COPY_AND_ASSIGN(Catalog); |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 } // namespace catalog | 83 } // namespace catalog |
| 84 | 84 |
| 85 #endif // SERVICES_CATALOG_CATALOG_H_ | 85 #endif // SERVICES_CATALOG_CATALOG_H_ |
| OLD | NEW |