| 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/application/public/cpp/lib/service_registry.h" | 5 #include "mojo/application/public/cpp/lib/service_registry.h" |
| 6 | 6 |
| 7 #include "mojo/application/public/cpp/application_connection.h" | 7 #include "mojo/application/public/cpp/application_connection.h" |
| 8 #include "mojo/application/public/cpp/application_impl.h" | 8 #include "mojo/application/public/cpp/application_impl.h" |
| 9 #include "mojo/application/public/cpp/service_connector.h" | 9 #include "mojo/application/public/cpp/service_connector.h" |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 local_binding_(this), | 23 local_binding_(this), |
| 24 remote_service_provider_(remote_services.Pass()) { | 24 remote_service_provider_(remote_services.Pass()) { |
| 25 if (local_services.is_pending()) | 25 if (local_services.is_pending()) |
| 26 local_binding_.Bind(local_services.Pass()); | 26 local_binding_.Bind(local_services.Pass()); |
| 27 } | 27 } |
| 28 | 28 |
| 29 ServiceRegistry::ServiceRegistry() | 29 ServiceRegistry::ServiceRegistry() |
| 30 : application_impl_(nullptr), local_binding_(this) { | 30 : application_impl_(nullptr), local_binding_(this) { |
| 31 } | 31 } |
| 32 | 32 |
| 33 ServiceRegistry::~ServiceRegistry() { | |
| 34 } | |
| 35 | |
| 36 void ServiceRegistry::SetServiceConnector(ServiceConnector* connector) { | 33 void ServiceRegistry::SetServiceConnector(ServiceConnector* connector) { |
| 37 service_connector_registry_.set_service_connector(connector); | 34 service_connector_registry_.set_service_connector(connector); |
| 38 } | 35 } |
| 39 | 36 |
| 40 void ServiceRegistry::SetServiceConnectorForName( | 37 void ServiceRegistry::SetServiceConnectorForName( |
| 41 ServiceConnector* service_connector, | 38 ServiceConnector* service_connector, |
| 42 const std::string& interface_name) { | 39 const std::string& interface_name) { |
| 43 service_connector_registry_.SetServiceConnectorForName(service_connector, | 40 service_connector_registry_.SetServiceConnectorForName(service_connector, |
| 44 interface_name); | 41 interface_name); |
| 45 } | 42 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 56 } | 53 } |
| 57 | 54 |
| 58 const std::string& ServiceRegistry::GetRemoteApplicationURL() { | 55 const std::string& ServiceRegistry::GetRemoteApplicationURL() { |
| 59 return remote_url_; | 56 return remote_url_; |
| 60 } | 57 } |
| 61 | 58 |
| 62 ServiceProvider* ServiceRegistry::GetServiceProvider() { | 59 ServiceProvider* ServiceRegistry::GetServiceProvider() { |
| 63 return remote_service_provider_.get(); | 60 return remote_service_provider_.get(); |
| 64 } | 61 } |
| 65 | 62 |
| 63 void ServiceRegistry::OnCloseConnection() { |
| 64 if (application_impl_) |
| 65 application_impl_->CloseConnection(this); |
| 66 } |
| 67 |
| 66 void ServiceRegistry::ConnectToService(const mojo::String& service_name, | 68 void ServiceRegistry::ConnectToService(const mojo::String& service_name, |
| 67 ScopedMessagePipeHandle client_handle) { | 69 ScopedMessagePipeHandle client_handle) { |
| 68 service_connector_registry_.ConnectToService(this, service_name, | 70 service_connector_registry_.ConnectToService(this, service_name, |
| 69 client_handle.Pass()); | 71 client_handle.Pass()); |
| 70 } | 72 } |
| 71 | 73 |
| 74 ServiceRegistry::~ServiceRegistry() { |
| 75 } |
| 76 |
| 72 } // namespace internal | 77 } // namespace internal |
| 73 } // namespace mojo | 78 } // namespace mojo |
| OLD | NEW |