| 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_CATALOG_H_ | 5 #ifndef MOJO_SERVICES_CATALOG_CATALOG_H_ |
| 6 #define MOJO_SERVICES_CATALOG_CATALOG_H_ | 6 #define MOJO_SERVICES_CATALOG_CATALOG_H_ |
| 7 | 7 |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "mojo/public/cpp/bindings/binding_set.h" | 12 #include "mojo/public/cpp/bindings/binding_set.h" |
| 13 #include "mojo/services/catalog/entry.h" | 13 #include "mojo/services/catalog/entry.h" |
| 14 #include "mojo/services/catalog/public/interfaces/catalog.mojom.h" | 14 #include "mojo/services/catalog/public/interfaces/catalog.mojom.h" |
| 15 #include "mojo/services/catalog/public/interfaces/resolver.mojom.h" | 15 #include "mojo/services/catalog/public/interfaces/resolver.mojom.h" |
| 16 #include "mojo/services/catalog/store.h" | 16 #include "mojo/services/catalog/store.h" |
| 17 #include "mojo/shell/public/cpp/interface_factory.h" | 17 #include "mojo/shell/public/cpp/interface_factory.h" |
| 18 #include "mojo/shell/public/cpp/shell_client.h" | |
| 19 #include "mojo/shell/public/interfaces/shell_resolver.mojom.h" | 18 #include "mojo/shell/public/interfaces/shell_resolver.mojom.h" |
| 20 #include "url/gurl.h" | 19 #include "url/gurl.h" |
| 21 | 20 |
| 22 namespace catalog { | 21 namespace catalog { |
| 23 | 22 |
| 24 class Store; | 23 class Store; |
| 25 | 24 |
| 26 class Catalog | 25 class Catalog : public mojom::Resolver, |
| 27 : public mojo::ShellClient, | 26 public mojo::shell::mojom::ShellResolver, |
| 28 public mojo::InterfaceFactory<mojom::Resolver>, | 27 public mojom::Catalog { |
| 29 public mojo::InterfaceFactory<mojo::shell::mojom::ShellResolver>, | |
| 30 public mojo::InterfaceFactory<mojom::Catalog>, | |
| 31 public mojom::Resolver, | |
| 32 public mojo::shell::mojom::ShellResolver, | |
| 33 public mojom::Catalog { | |
| 34 public: | 28 public: |
| 35 // If |register_schemes| is true, mojo: and exe: schemes are registered as | |
| 36 // "standard". | |
| 37 Catalog(base::TaskRunner* blocking_pool, scoped_ptr<Store> store); | 29 Catalog(base::TaskRunner* blocking_pool, scoped_ptr<Store> store); |
| 38 ~Catalog() override; | 30 ~Catalog() override; |
| 39 | 31 |
| 32 void BindResolver(mojom::ResolverRequest request); |
| 33 void BindShellResolver(mojo::shell::mojom::ShellResolverRequest request); |
| 34 void BindCatalog(mojom::CatalogRequest request); |
| 35 |
| 40 private: | 36 private: |
| 41 using MojoNameAliasMap = | 37 using MojoNameAliasMap = |
| 42 std::map<std::string, std::pair<std::string, std::string>>; | 38 std::map<std::string, std::pair<std::string, std::string>>; |
| 43 | 39 |
| 44 // mojo::ShellClient: | |
| 45 bool AcceptConnection(mojo::Connection* connection) override; | |
| 46 | |
| 47 // mojo::InterfaceFactory<mojom::Resolver>: | |
| 48 void Create(mojo::Connection* connection, | |
| 49 mojom::ResolverRequest request) override; | |
| 50 | |
| 51 // mojo::InterfaceFactory<mojo::shell::mojom::ShellResolver>: | |
| 52 void Create(mojo::Connection* connection, | |
| 53 mojo::shell::mojom::ShellResolverRequest request) override; | |
| 54 | |
| 55 // mojo::InterfaceFactory<mojom::Catalog>: | |
| 56 void Create(mojo::Connection* connection, | |
| 57 mojom::CatalogRequest request) override; | |
| 58 | |
| 59 // mojom::Resolver: | 40 // mojom::Resolver: |
| 60 void ResolveResponse( | 41 void ResolveResponse( |
| 61 mojo::URLResponsePtr response, | 42 mojo::URLResponsePtr response, |
| 62 const ResolveResponseCallback& callback) override; | 43 const ResolveResponseCallback& callback) override; |
| 63 void ResolveInterfaces(mojo::Array<mojo::String> interfaces, | 44 void ResolveInterfaces(mojo::Array<mojo::String> interfaces, |
| 64 const ResolveInterfacesCallback& callback) override; | 45 const ResolveInterfacesCallback& callback) override; |
| 65 void ResolveMIMEType(const mojo::String& mime_type, | 46 void ResolveMIMEType(const mojo::String& mime_type, |
| 66 const ResolveMIMETypeCallback& callback) override; | 47 const ResolveMIMETypeCallback& callback) override; |
| 67 void ResolveProtocolScheme( | 48 void ResolveProtocolScheme( |
| 68 const mojo::String& scheme, | 49 const mojo::String& scheme, |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 std::map<std::string, std::string> qualifiers_; | 110 std::map<std::string, std::string> qualifiers_; |
| 130 | 111 |
| 131 base::WeakPtrFactory<Catalog> weak_factory_; | 112 base::WeakPtrFactory<Catalog> weak_factory_; |
| 132 | 113 |
| 133 DISALLOW_COPY_AND_ASSIGN(Catalog); | 114 DISALLOW_COPY_AND_ASSIGN(Catalog); |
| 134 }; | 115 }; |
| 135 | 116 |
| 136 } // namespace catalog | 117 } // namespace catalog |
| 137 | 118 |
| 138 #endif // MOJO_SERVICES_CATALOG_CATALOG_H_ | 119 #endif // MOJO_SERVICES_CATALOG_CATALOG_H_ |
| OLD | NEW |