| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/browser/frame_host/frame_mojo_shell.h" | 5 #include "content/browser/frame_host/frame_mojo_shell.h" |
| 6 | 6 |
| 7 #include "content/browser/mojo/mojo_shell_context.h" | 7 #include "content/browser/mojo/mojo_shell_context.h" |
| 8 #include "content/common/mojo/service_registry_impl.h" |
| 9 #include "content/public/browser/content_browser_client.h" |
| 8 #include "content/public/browser/render_frame_host.h" | 10 #include "content/public/browser/render_frame_host.h" |
| 9 #include "content/public/browser/site_instance.h" | 11 #include "content/public/browser/site_instance.h" |
| 12 #include "content/public/common/content_client.h" |
| 10 | 13 |
| 11 namespace content { | 14 namespace content { |
| 12 | 15 |
| 13 FrameMojoShell::FrameMojoShell(RenderFrameHost* frame_host) | 16 FrameMojoShell::FrameMojoShell(RenderFrameHost* frame_host) |
| 14 : frame_host_(frame_host) { | 17 : frame_host_(frame_host) { |
| 15 } | 18 } |
| 16 | 19 |
| 17 FrameMojoShell::~FrameMojoShell() { | 20 FrameMojoShell::~FrameMojoShell() { |
| 18 } | 21 } |
| 19 | 22 |
| 20 void FrameMojoShell::BindRequest( | 23 void FrameMojoShell::BindRequest( |
| 21 mojo::InterfaceRequest<mojo::Shell> shell_request) { | 24 mojo::InterfaceRequest<mojo::Shell> shell_request) { |
| 22 bindings_.AddBinding(this, shell_request.Pass()); | 25 bindings_.AddBinding(this, shell_request.Pass()); |
| 23 } | 26 } |
| 24 | 27 |
| 28 // TODO(xhwang): Currently no callers are exposing |exposed_services|. So we |
| 29 // drop it and replace it with services we provide in the browser. In the |
| 30 // future we may need to support both. |
| 25 void FrameMojoShell::ConnectToApplication( | 31 void FrameMojoShell::ConnectToApplication( |
| 26 mojo::URLRequestPtr application_url, | 32 mojo::URLRequestPtr application_url, |
| 27 mojo::InterfaceRequest<mojo::ServiceProvider> services, | 33 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 28 mojo::ServiceProviderPtr exposed_services) { | 34 mojo::ServiceProviderPtr /* exposed_services */) { |
| 35 mojo::ServiceProviderPtr frame_services; |
| 36 service_provider_bindings_.AddBinding(GetServiceRegistry(), |
| 37 GetProxy(&frame_services)); |
| 38 |
| 29 MojoShellContext::ConnectToApplication( | 39 MojoShellContext::ConnectToApplication( |
| 30 GURL(application_url->url), frame_host_->GetSiteInstance()->GetSiteURL(), | 40 GURL(application_url->url), frame_host_->GetSiteInstance()->GetSiteURL(), |
| 31 services.Pass()); | 41 services.Pass(), frame_services.Pass()); |
| 32 } | 42 } |
| 33 | 43 |
| 34 void FrameMojoShell::QuitApplication() { | 44 void FrameMojoShell::QuitApplication() { |
| 35 } | 45 } |
| 36 | 46 |
| 47 ServiceRegistryImpl* FrameMojoShell::GetServiceRegistry() { |
| 48 if (!service_registry_) { |
| 49 service_registry_.reset(new ServiceRegistryImpl()); |
| 50 |
| 51 GetContentClient()->browser()->OverrideFrameMojoShellServices( |
| 52 service_registry_.get(), frame_host_); |
| 53 } |
| 54 |
| 55 return service_registry_.get(); |
| 56 } |
| 57 |
| 37 } // namespace content | 58 } // namespace content |
| OLD | NEW |