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