Chromium Code Reviews| Index: content/browser/renderer_host/render_process_host_impl.cc |
| diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc |
| index e779da3670b2c0ce4a7944ebba76613d91d1be91..f1fe9aaebc93b6a799777d55d2ec680f23c1b5bb 100644 |
| --- a/content/browser/renderer_host/render_process_host_impl.cc |
| +++ b/content/browser/renderer_host/render_process_host_impl.cc |
| @@ -1321,8 +1321,16 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() { |
| base::Unretained( |
| memory_instrumentation::CoordinatorImpl::GetInstance()))); |
| - GetContentClient()->browser()->ExposeInterfacesToRenderer(registry.get(), |
| - this); |
| + associated_registry_.reset(new AssociatedInterfaceRegistryImpl()); |
| + GetContentClient()->browser()->ExposeInterfacesToRenderer( |
| + registry.get(), associated_registry_.get(), this); |
| + // We say static_cast<AIR*>(ar.get())->Etc instead of just ar->Etc because |
| + // the ar field is an AIRImpl*, not an AIR*, and AIRImpl overloads the |
| + // AddInterface method to provide a 2-argument form, but we want the |
| + // templated helper 1-argument form defined on the abstract superclass. |
| + static_cast<AssociatedInterfaceRegistry*>(associated_registry_.get()) |
|
Ken Rockot(use gerrit already)
2017/04/20 15:49:42
nit: This is unfortunate, but I really don't think
nigeltao1
2017/04/21 00:07:54
Done.
|
| + ->AddInterface(base::Bind(&RenderProcessHostImpl::BindRouteProvider, |
| + base::Unretained(this))); |
| ServiceManagerConnection* service_manager_connection = |
| BrowserContext::GetServiceManagerConnectionFor(browser_context_); |
| @@ -1334,6 +1342,13 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() { |
| std::move(connection_filter)); |
| } |
| +void RenderProcessHostImpl::BindRouteProvider( |
| + mojom::RouteProviderAssociatedRequest request) { |
| + if (route_provider_binding_.is_bound()) |
| + return; |
| + route_provider_binding_.Bind(std::move(request)); |
| +} |
| + |
| void RenderProcessHostImpl::GetRoute( |
| int32_t routing_id, |
| mojom::AssociatedInterfaceProviderAssociatedRequest request) { |
| @@ -2079,12 +2094,8 @@ bool RenderProcessHostImpl::OnMessageReceived(const IPC::Message& msg) { |
| void RenderProcessHostImpl::OnAssociatedInterfaceRequest( |
| const std::string& interface_name, |
| mojo::ScopedInterfaceEndpointHandle handle) { |
| - if (interface_name == mojom::RouteProvider::Name_) { |
| - if (route_provider_binding_.is_bound()) |
| - return; |
| - mojom::RouteProviderAssociatedRequest request; |
| - request.Bind(std::move(handle)); |
| - route_provider_binding_.Bind(std::move(request)); |
| + if (associated_registry_->CanBindRequest(interface_name)) { |
| + associated_registry_->BindRequest(interface_name, std::move(handle)); |
| } else { |
| LOG(ERROR) << "Request for unknown Channel-associated interface: " |
| << interface_name; |