| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "content/browser/mojo/mojo_shell_context.h" | 10 #include "content/browser/mojo/mojo_shell_context.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 } // namespace | 36 } // namespace |
| 37 | 37 |
| 38 FrameMojoShell::FrameMojoShell(RenderFrameHost* frame_host) | 38 FrameMojoShell::FrameMojoShell(RenderFrameHost* frame_host) |
| 39 : frame_host_(frame_host) { | 39 : frame_host_(frame_host) { |
| 40 } | 40 } |
| 41 | 41 |
| 42 FrameMojoShell::~FrameMojoShell() { | 42 FrameMojoShell::~FrameMojoShell() { |
| 43 } | 43 } |
| 44 | 44 |
| 45 void FrameMojoShell::BindRequest(mojo::shell::mojom::ConnectorRequest request) { | 45 void FrameMojoShell::BindRequest(shell::mojom::ConnectorRequest request) { |
| 46 connectors_.AddBinding(this, std::move(request)); | 46 connectors_.AddBinding(this, std::move(request)); |
| 47 } | 47 } |
| 48 | 48 |
| 49 // TODO(xhwang): Currently no callers are exposing |exposed_services|. So we | 49 // TODO(xhwang): Currently no callers are exposing |exposed_services|. So we |
| 50 // drop it and replace it with services we provide in the browser. In the | 50 // drop it and replace it with services we provide in the browser. In the |
| 51 // future we may need to support both. | 51 // future we may need to support both. |
| 52 void FrameMojoShell::Connect( | 52 void FrameMojoShell::Connect( |
| 53 mojo::shell::mojom::IdentityPtr target, | 53 shell::mojom::IdentityPtr target, |
| 54 mojo::shell::mojom::InterfaceProviderRequest services, | 54 shell::mojom::InterfaceProviderRequest services, |
| 55 mojo::shell::mojom::InterfaceProviderPtr /* exposed_services */, | 55 shell::mojom::InterfaceProviderPtr /* exposed_services */, |
| 56 mojo::shell::mojom::ClientProcessConnectionPtr client_process_connection, | 56 shell::mojom::ClientProcessConnectionPtr client_process_connection, |
| 57 const mojo::shell::mojom::Connector::ConnectCallback& callback) { | 57 const shell::mojom::Connector::ConnectCallback& callback) { |
| 58 mojo::shell::mojom::InterfaceProviderPtr frame_services; | 58 shell::mojom::InterfaceProviderPtr frame_services; |
| 59 service_provider_bindings_.AddBinding(GetServiceRegistry(), | 59 service_provider_bindings_.AddBinding(GetServiceRegistry(), |
| 60 GetProxy(&frame_services)); | 60 GetProxy(&frame_services)); |
| 61 std::string mojo_user_id = BrowserContext::GetMojoUserIdFor( | 61 std::string mojo_user_id = BrowserContext::GetMojoUserIdFor( |
| 62 frame_host_->GetProcess()->GetBrowserContext()); | 62 frame_host_->GetProcess()->GetBrowserContext()); |
| 63 MojoShellContext::ConnectToApplication( | 63 MojoShellContext::ConnectToApplication( |
| 64 mojo_user_id, target->name, | 64 mojo_user_id, target->name, |
| 65 frame_host_->GetSiteInstance()->GetSiteURL().spec(), std::move(services), | 65 frame_host_->GetSiteInstance()->GetSiteURL().spec(), std::move(services), |
| 66 std::move(frame_services), callback); | 66 std::move(frame_services), callback); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void FrameMojoShell::Clone(mojo::shell::mojom::ConnectorRequest request) { | 69 void FrameMojoShell::Clone(shell::mojom::ConnectorRequest request) { |
| 70 connectors_.AddBinding(this, std::move(request)); | 70 connectors_.AddBinding(this, std::move(request)); |
| 71 } | 71 } |
| 72 | 72 |
| 73 ServiceRegistryImpl* FrameMojoShell::GetServiceRegistry() { | 73 ServiceRegistryImpl* FrameMojoShell::GetServiceRegistry() { |
| 74 if (!service_registry_) { | 74 if (!service_registry_) { |
| 75 service_registry_.reset(new ServiceRegistryImpl()); | 75 service_registry_.reset(new ServiceRegistryImpl()); |
| 76 | 76 |
| 77 // TODO(rockot/xhwang): Currently all applications connected share the same | 77 // TODO(rockot/xhwang): Currently all applications connected share the same |
| 78 // set of services registered in the |registry|. We may want to provide | 78 // set of services registered in the |registry|. We may want to provide |
| 79 // different services for different apps for better isolation. | 79 // different services for different apps for better isolation. |
| 80 RegisterFrameMojoShellServices(service_registry_.get(), frame_host_); | 80 RegisterFrameMojoShellServices(service_registry_.get(), frame_host_); |
| 81 GetContentClient()->browser()->RegisterFrameMojoShellServices( | 81 GetContentClient()->browser()->RegisterFrameMojoShellServices( |
| 82 service_registry_.get(), frame_host_); | 82 service_registry_.get(), frame_host_); |
| 83 } | 83 } |
| 84 | 84 |
| 85 return service_registry_.get(); | 85 return service_registry_.get(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 } // namespace content | 88 } // namespace content |
| OLD | NEW |