OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_PUBLIC_CPP_APPLICATION_LIB_SERVICE_REGISTRY_H_ | 5 #ifndef MOJO_PUBLIC_CPP_APPLICATION_LIB_SERVICE_REGISTRY_H_ |
6 #define MOJO_PUBLIC_CPP_APPLICATION_LIB_SERVICE_REGISTRY_H_ | 6 #define MOJO_PUBLIC_CPP_APPLICATION_LIB_SERVICE_REGISTRY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "mojo/public/cpp/application/application_connection.h" | 10 #include "mojo/public/cpp/application/application_connection.h" |
11 #include "mojo/public/cpp/application/connection_context.h" | 11 #include "mojo/public/cpp/application/service_provider_impl.h" |
12 #include "mojo/public/cpp/application/lib/service_connector_registry.h" | |
13 #include "mojo/public/cpp/bindings/binding.h" | |
14 #include "mojo/public/interfaces/application/service_provider.mojom.h" | |
15 | 12 |
16 namespace mojo { | 13 namespace mojo { |
17 namespace internal { | 14 namespace internal { |
18 | 15 |
19 // A ServiceRegistry represents each half of a connection between two | 16 // A ServiceRegistry represents each half of a connection between two |
20 // applications, allowing customization of which services are published to the | 17 // applications, allowing customization of which services are published to the |
21 // other. | 18 // other. |
22 class ServiceRegistry : public ServiceProvider, public ApplicationConnection { | 19 class ServiceRegistry : public ApplicationConnection { |
23 public: | 20 public: |
24 ServiceRegistry(); | 21 ServiceRegistry(); |
25 ServiceRegistry(const ConnectionContext& connection_context, | 22 ServiceRegistry(const ConnectionContext& connection_context, |
26 InterfaceRequest<ServiceProvider> local_services); | 23 InterfaceRequest<ServiceProvider> local_services); |
27 ~ServiceRegistry() override; | 24 ~ServiceRegistry() override; |
28 | 25 |
29 // ApplicationConnection overrides. | 26 // ApplicationConnection overrides. |
30 void SetServiceConnectorForName(ServiceConnector* service_connector, | 27 void SetServiceConnectorForName(ServiceConnector* service_connector, |
31 const std::string& interface_name) override; | 28 const std::string& interface_name) override; |
| 29 ServiceProviderImpl& GetServiceProviderImpl() override; |
32 const ConnectionContext& GetConnectionContext() const override; | 30 const ConnectionContext& GetConnectionContext() const override; |
33 const std::string& GetConnectionURL() override; | 31 const std::string& GetConnectionURL() override; |
34 const std::string& GetRemoteApplicationURL() override; | 32 const std::string& GetRemoteApplicationURL() override; |
35 | 33 |
36 void RemoveServiceConnectorForName(const std::string& interface_name); | 34 void RemoveServiceConnectorForName(const std::string& interface_name); |
37 | 35 |
38 private: | 36 private: |
39 // ServiceProvider method. | 37 ServiceProviderImpl service_provider_impl_; |
40 void ConnectToService(const String& service_name, | |
41 ScopedMessagePipeHandle client_handle) override; | |
42 | |
43 ConnectionContext connection_context_; | |
44 Binding<ServiceProvider> local_binding_; | |
45 ServiceConnectorRegistry service_connector_registry_; | |
46 | 38 |
47 MOJO_DISALLOW_COPY_AND_ASSIGN(ServiceRegistry); | 39 MOJO_DISALLOW_COPY_AND_ASSIGN(ServiceRegistry); |
48 }; | 40 }; |
49 | 41 |
50 } // namespace internal | 42 } // namespace internal |
51 } // namespace mojo | 43 } // namespace mojo |
52 | 44 |
53 #endif // MOJO_PUBLIC_CPP_APPLICATION_LIB_SERVICE_REGISTRY_H_ | 45 #endif // MOJO_PUBLIC_CPP_APPLICATION_LIB_SERVICE_REGISTRY_H_ |
OLD | NEW |