Chromium Code Reviews| 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" | |
| 13 #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h" | |
|
Ken Rockot(use gerrit already)
2015/07/07 19:25:46
nit: can remove this now
xhwang
2015/07/07 19:31:41
Done.
| |
| 10 | 14 |
| 11 namespace content { | 15 namespace content { |
| 12 | 16 |
| 13 FrameMojoShell::FrameMojoShell(RenderFrameHost* frame_host) | 17 FrameMojoShell::FrameMojoShell(RenderFrameHost* frame_host) |
| 14 : frame_host_(frame_host) { | 18 : frame_host_(frame_host) { |
| 15 } | 19 } |
| 16 | 20 |
| 17 FrameMojoShell::~FrameMojoShell() { | 21 FrameMojoShell::~FrameMojoShell() { |
| 18 } | 22 } |
| 19 | 23 |
| 20 void FrameMojoShell::BindRequest( | 24 void FrameMojoShell::BindRequest( |
| 21 mojo::InterfaceRequest<mojo::Shell> shell_request) { | 25 mojo::InterfaceRequest<mojo::Shell> shell_request) { |
| 22 bindings_.AddBinding(this, shell_request.Pass()); | 26 bindings_.AddBinding(this, shell_request.Pass()); |
| 23 } | 27 } |
| 24 | 28 |
| 29 // TODO(xhwang): Currently no callers are exposing |exposed_services|. So we | |
| 30 // drop it and replace it with services we provide in the browser. In the | |
| 31 // future we may need to support both. | |
| 25 void FrameMojoShell::ConnectToApplication( | 32 void FrameMojoShell::ConnectToApplication( |
| 26 mojo::URLRequestPtr application_url, | 33 mojo::URLRequestPtr application_url, |
| 27 mojo::InterfaceRequest<mojo::ServiceProvider> services, | 34 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 28 mojo::ServiceProviderPtr exposed_services) { | 35 mojo::ServiceProviderPtr /* exposed_services */) { |
| 36 mojo::ServiceProviderPtr frame_services; | |
| 37 service_provider_bindings_.AddBinding(GetServiceRegistry(), | |
| 38 GetProxy(&frame_services)); | |
| 39 | |
| 29 MojoShellContext::ConnectToApplication( | 40 MojoShellContext::ConnectToApplication( |
| 30 GURL(application_url->url), frame_host_->GetSiteInstance()->GetSiteURL(), | 41 GURL(application_url->url), frame_host_->GetSiteInstance()->GetSiteURL(), |
| 31 services.Pass()); | 42 services.Pass(), frame_services.Pass()); |
| 32 } | 43 } |
| 33 | 44 |
| 34 void FrameMojoShell::QuitApplication() { | 45 void FrameMojoShell::QuitApplication() { |
| 35 } | 46 } |
| 36 | 47 |
| 48 ServiceRegistryImpl* FrameMojoShell::GetServiceRegistry() { | |
| 49 if (!service_registry_) { | |
| 50 service_registry_.reset(new ServiceRegistryImpl()); | |
| 51 | |
| 52 GetContentClient()->browser()->OverrideFrameMojoShellServices( | |
| 53 service_registry_.get(), frame_host_); | |
| 54 } | |
| 55 | |
| 56 return service_registry_.get(); | |
| 57 } | |
| 58 | |
| 37 } // namespace content | 59 } // namespace content |
| OLD | NEW |