| 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_APPLICATION_PUBLIC_CPP_LIB_SERVICE_REGISTRY_H_ | 5 #ifndef MOJO_APPLICATION_PUBLIC_CPP_LIB_SERVICE_REGISTRY_H_ |
| 6 #define MOJO_APPLICATION_PUBLIC_CPP_LIB_SERVICE_REGISTRY_H_ | 6 #define MOJO_APPLICATION_PUBLIC_CPP_LIB_SERVICE_REGISTRY_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "mojo/application/public/cpp/application_connection.h" | 10 #include "mojo/application/public/cpp/application_connection.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // applications, allowing customization of which services are published to the | 22 // applications, allowing customization of which services are published to the |
| 23 // other. | 23 // other. |
| 24 class ServiceRegistry : public ServiceProvider, public ApplicationConnection { | 24 class ServiceRegistry : public ServiceProvider, public ApplicationConnection { |
| 25 public: | 25 public: |
| 26 ServiceRegistry(); | 26 ServiceRegistry(); |
| 27 ServiceRegistry(ApplicationImpl* application_impl, | 27 ServiceRegistry(ApplicationImpl* application_impl, |
| 28 const std::string& connection_url, | 28 const std::string& connection_url, |
| 29 const std::string& remote_url, | 29 const std::string& remote_url, |
| 30 ServiceProviderPtr remote_services, | 30 ServiceProviderPtr remote_services, |
| 31 InterfaceRequest<ServiceProvider> local_services); | 31 InterfaceRequest<ServiceProvider> local_services); |
| 32 ~ServiceRegistry() override; | |
| 33 | 32 |
| 34 // ApplicationConnection overrides. | 33 // ApplicationConnection overrides. |
| 35 void SetServiceConnector(ServiceConnector* service_connector) override; | 34 void SetServiceConnector(ServiceConnector* service_connector) override; |
| 36 void SetServiceConnectorForName(ServiceConnector* service_connector, | 35 void SetServiceConnectorForName(ServiceConnector* service_connector, |
| 37 const std::string& interface_name) override; | 36 const std::string& interface_name) override; |
| 38 const std::string& GetConnectionURL() override; | 37 const std::string& GetConnectionURL() override; |
| 39 const std::string& GetRemoteApplicationURL() override; | 38 const std::string& GetRemoteApplicationURL() override; |
| 40 ServiceProvider* GetServiceProvider() override; | 39 ServiceProvider* GetServiceProvider() override; |
| 41 | 40 |
| 42 void RemoveServiceConnectorForName(const std::string& interface_name); | 41 void RemoveServiceConnectorForName(const std::string& interface_name); |
| 43 | 42 |
| 44 private: | 43 private: |
| 44 // ApplicationConnection overrides. |
| 45 void OnCloseConnection() override; |
| 46 |
| 45 // ServiceProvider method. | 47 // ServiceProvider method. |
| 46 void ConnectToService(const mojo::String& service_name, | 48 void ConnectToService(const mojo::String& service_name, |
| 47 ScopedMessagePipeHandle client_handle) override; | 49 ScopedMessagePipeHandle client_handle) override; |
| 48 | 50 |
| 49 ApplicationImpl* application_impl_; | 51 ApplicationImpl* application_impl_; |
| 50 const std::string connection_url_; | 52 const std::string connection_url_; |
| 51 const std::string remote_url_; | 53 const std::string remote_url_; |
| 52 | 54 |
| 53 private: | 55 private: |
| 54 void RemoveServiceConnectorForNameInternal(const std::string& interface_name); | 56 ~ServiceRegistry() override; |
| 55 | 57 |
| 56 Application* application_; | 58 Application* application_; |
| 57 Binding<ServiceProvider> local_binding_; | 59 Binding<ServiceProvider> local_binding_; |
| 58 ServiceProviderPtr remote_service_provider_; | 60 ServiceProviderPtr remote_service_provider_; |
| 59 ServiceConnectorRegistry service_connector_registry_; | 61 ServiceConnectorRegistry service_connector_registry_; |
| 60 | 62 |
| 61 MOJO_DISALLOW_COPY_AND_ASSIGN(ServiceRegistry); | 63 MOJO_DISALLOW_COPY_AND_ASSIGN(ServiceRegistry); |
| 62 }; | 64 }; |
| 63 | 65 |
| 64 } // namespace internal | 66 } // namespace internal |
| 65 } // namespace mojo | 67 } // namespace mojo |
| 66 | 68 |
| 67 #endif // MOJO_APPLICATION_PUBLIC_CPP_LIB_SERVICE_REGISTRY_H_ | 69 #endif // MOJO_APPLICATION_PUBLIC_CPP_LIB_SERVICE_REGISTRY_H_ |
| OLD | NEW |