| 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 #include "mojo/public/cpp/application/lib/service_registry.h" | 5 #include "mojo/public/cpp/application/lib/service_registry.h" |
| 6 | 6 |
| 7 #include "mojo/public/cpp/application/application_connection.h" | 7 #include "mojo/public/cpp/application/application_connection.h" |
| 8 #include "mojo/public/cpp/application/service_connector.h" | 8 #include "mojo/public/cpp/application/service_connector.h" |
| 9 | 9 |
| 10 namespace mojo { | 10 namespace mojo { |
| 11 namespace internal { | 11 namespace internal { |
| 12 | 12 |
| 13 ServiceRegistry::ServiceRegistry() {} | 13 ServiceRegistry::ServiceRegistry() {} |
| 14 | 14 |
| 15 ServiceRegistry::ServiceRegistry( | 15 ServiceRegistry::ServiceRegistry( |
| 16 const ConnectionContext& connection_context, | 16 const ConnectionContext& connection_context, |
| 17 InterfaceRequest<ServiceProvider> local_services) | 17 InterfaceRequest<ServiceProvider> local_services) |
| 18 : service_provider_impl_(connection_context, local_services.Pass()) {} | 18 : service_provider_impl_(connection_context, local_services.Pass()) {} |
| 19 | 19 |
| 20 ServiceRegistry::~ServiceRegistry() {} | 20 ServiceRegistry::~ServiceRegistry() {} |
| 21 | 21 |
| 22 void ServiceRegistry::SetServiceConnectorForName( | |
| 23 ServiceConnector* service_connector, | |
| 24 const std::string& interface_name) { | |
| 25 service_provider_impl_.AddServiceForName( | |
| 26 std::unique_ptr<ServiceConnector>(service_connector), interface_name); | |
| 27 } | |
| 28 | |
| 29 void ServiceRegistry::RemoveServiceConnectorForName( | 22 void ServiceRegistry::RemoveServiceConnectorForName( |
| 30 const std::string& interface_name) { | 23 const std::string& interface_name) { |
| 31 service_provider_impl_.RemoveServiceForName(interface_name); | 24 service_provider_impl_.RemoveServiceForName(interface_name); |
| 32 } | 25 } |
| 33 | 26 |
| 34 ServiceProviderImpl& ServiceRegistry::GetServiceProviderImpl() { | 27 ServiceProviderImpl& ServiceRegistry::GetServiceProviderImpl() { |
| 35 return service_provider_impl_; | 28 return service_provider_impl_; |
| 36 } | 29 } |
| 37 | 30 |
| 38 const ConnectionContext& ServiceRegistry::GetConnectionContext() const { | |
| 39 return service_provider_impl_.connection_context(); | |
| 40 } | |
| 41 | |
| 42 const std::string& ServiceRegistry::GetConnectionURL() { | |
| 43 return service_provider_impl_.connection_context().connection_url; | |
| 44 } | |
| 45 | |
| 46 const std::string& ServiceRegistry::GetRemoteApplicationURL() { | |
| 47 return service_provider_impl_.connection_context().remote_url; | |
| 48 } | |
| 49 | |
| 50 } // namespace internal | 31 } // namespace internal |
| 51 } // namespace mojo | 32 } // namespace mojo |
| OLD | NEW |