Index: services/service_manager/public/cpp/lib/service_context.cc |
diff --git a/services/service_manager/public/cpp/lib/service_context.cc b/services/service_manager/public/cpp/lib/service_context.cc |
index 88074a776d8e3009e4472ad145ce6ebeecc7ef8a..ed133376401f373aead11d7de47b264fc4b39d5d 100644 |
--- a/services/service_manager/public/cpp/lib/service_context.cc |
+++ b/services/service_manager/public/cpp/lib/service_context.cc |
@@ -98,14 +98,46 @@ void ServiceContext::OnConnect( |
local_info_.interface_provider_specs, &target_spec); |
GetInterfaceProviderSpec(mojom::kServiceManager_ConnectorSpec, |
source_info.interface_provider_specs, &source_spec); |
+ |
+ // Acknowledge the request regardless of whether it's accepted. |
+ callback.Run(); |
+ |
+ CallOnConnect(source_info, source_spec, target_spec, std::move(interfaces)); |
+} |
+ |
+void ServiceContext::OnBindInterface( |
+ const ServiceInfo& source_info, |
+ const std::string& interface_name, |
+ mojo::ScopedMessagePipeHandle interface_pipe, |
+ const OnBindInterfaceCallback& callback) { |
+ // Acknowledge the request regardless of whether it's accepted. |
+ callback.Run(); |
+ |
+ mojom::InterfaceProviderPtr interface_provider; |
+ // TODO(beng): This should be replaced with a call to OnBindInterface() in a |
+ // subsequent change. |
+ InterfaceProviderSpec source_spec, target_spec; |
+ GetInterfaceProviderSpec(mojom::kServiceManager_ConnectorSpec, |
+ local_info_.interface_provider_specs, &target_spec); |
+ GetInterfaceProviderSpec(mojom::kServiceManager_ConnectorSpec, |
+ source_info.interface_provider_specs, &source_spec); |
+ CallOnConnect(source_info, source_spec, target_spec, |
+ MakeRequest(&interface_provider)); |
+ interface_provider->GetInterface(interface_name, std::move(interface_pipe)); |
+} |
+ |
+//////////////////////////////////////////////////////////////////////////////// |
+// ServiceContext, private: |
+ |
+void ServiceContext::CallOnConnect(const ServiceInfo& source_info, |
+ const InterfaceProviderSpec& source_spec, |
+ const InterfaceProviderSpec& target_spec, |
+ mojom::InterfaceProviderRequest interfaces) { |
auto registry = |
base::MakeUnique<InterfaceRegistry>(mojom::kServiceManager_ConnectorSpec); |
registry->Bind(std::move(interfaces), local_info_.identity, target_spec, |
source_info.identity, source_spec); |
- // Acknowledge the request regardless of whether it's accepted. |
- callback.Run(); |
- |
if (!service_->OnConnect(source_info, registry.get())) |
return; |
@@ -117,9 +149,6 @@ void ServiceContext::OnConnect( |
std::make_pair(raw_registry, std::move(registry))); |
} |
-//////////////////////////////////////////////////////////////////////////////// |
-// ServiceContext, private: |
- |
void ServiceContext::OnConnectionError() { |
// Note that the Service doesn't technically have to quit now, it may live |
// on to service existing connections. All existing Connectors however are |