| 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" |
| 11 #include "content/common/mojo/service_registry_impl.h" | 11 #include "content/common/mojo/service_registry_impl.h" |
| 12 #include "content/public/browser/browser_context.h" | |
| 13 #include "content/public/browser/content_browser_client.h" | 12 #include "content/public/browser/content_browser_client.h" |
| 14 #include "content/public/browser/render_frame_host.h" | 13 #include "content/public/browser/render_frame_host.h" |
| 15 #include "content/public/browser/render_process_host.h" | 14 #include "content/public/browser/render_process_host.h" |
| 16 #include "content/public/browser/site_instance.h" | 15 #include "content/public/browser/site_instance.h" |
| 17 #include "content/public/common/content_client.h" | 16 #include "content/public/common/content_client.h" |
| 18 #include "mojo/common/url_type_converters.h" | 17 #include "mojo/common/url_type_converters.h" |
| 19 | 18 |
| 20 #if defined(OS_ANDROID) && defined(ENABLE_MOJO_CDM) | 19 #if defined(OS_ANDROID) && defined(ENABLE_MOJO_CDM) |
| 21 #include "content/browser/media/android/provision_fetcher_impl.h" | 20 #include "content/browser/media/android/provision_fetcher_impl.h" |
| 22 #endif | 21 #endif |
| (...skipping 28 matching lines...) Expand all Loading... |
| 51 // future we may need to support both. | 50 // future we may need to support both. |
| 52 void FrameMojoShell::Connect( | 51 void FrameMojoShell::Connect( |
| 53 shell::mojom::IdentityPtr target, | 52 shell::mojom::IdentityPtr target, |
| 54 shell::mojom::InterfaceProviderRequest services, | 53 shell::mojom::InterfaceProviderRequest services, |
| 55 shell::mojom::InterfaceProviderPtr /* exposed_services */, | 54 shell::mojom::InterfaceProviderPtr /* exposed_services */, |
| 56 shell::mojom::ClientProcessConnectionPtr client_process_connection, | 55 shell::mojom::ClientProcessConnectionPtr client_process_connection, |
| 57 const shell::mojom::Connector::ConnectCallback& callback) { | 56 const shell::mojom::Connector::ConnectCallback& callback) { |
| 58 shell::mojom::InterfaceProviderPtr frame_services; | 57 shell::mojom::InterfaceProviderPtr frame_services; |
| 59 service_provider_bindings_.AddBinding(GetServiceRegistry(), | 58 service_provider_bindings_.AddBinding(GetServiceRegistry(), |
| 60 GetProxy(&frame_services)); | 59 GetProxy(&frame_services)); |
| 61 std::string mojo_user_id = BrowserContext::GetMojoUserIdFor( | |
| 62 frame_host_->GetProcess()->GetBrowserContext()); | |
| 63 MojoShellContext::ConnectToApplication( | 60 MojoShellContext::ConnectToApplication( |
| 64 mojo_user_id, target->name, | 61 shell::mojom::kRootUserID, target->name, |
| 65 frame_host_->GetSiteInstance()->GetSiteURL().spec(), std::move(services), | 62 frame_host_->GetSiteInstance()->GetSiteURL().spec(), std::move(services), |
| 66 std::move(frame_services), callback); | 63 std::move(frame_services), callback); |
| 67 } | 64 } |
| 68 | 65 |
| 69 void FrameMojoShell::Clone(shell::mojom::ConnectorRequest request) { | 66 void FrameMojoShell::Clone(shell::mojom::ConnectorRequest request) { |
| 70 connectors_.AddBinding(this, std::move(request)); | 67 connectors_.AddBinding(this, std::move(request)); |
| 71 } | 68 } |
| 72 | 69 |
| 73 ServiceRegistryImpl* FrameMojoShell::GetServiceRegistry() { | 70 ServiceRegistryImpl* FrameMojoShell::GetServiceRegistry() { |
| 74 if (!service_registry_) { | 71 if (!service_registry_) { |
| 75 service_registry_.reset(new ServiceRegistryImpl()); | 72 service_registry_.reset(new ServiceRegistryImpl()); |
| 76 | 73 |
| 77 // TODO(rockot/xhwang): Currently all applications connected share the same | 74 // TODO(rockot/xhwang): Currently all applications connected share the same |
| 78 // set of services registered in the |registry|. We may want to provide | 75 // set of services registered in the |registry|. We may want to provide |
| 79 // different services for different apps for better isolation. | 76 // different services for different apps for better isolation. |
| 80 RegisterFrameMojoShellServices(service_registry_.get(), frame_host_); | 77 RegisterFrameMojoShellServices(service_registry_.get(), frame_host_); |
| 81 GetContentClient()->browser()->RegisterFrameMojoShellServices( | 78 GetContentClient()->browser()->RegisterFrameMojoShellServices( |
| 82 service_registry_.get(), frame_host_); | 79 service_registry_.get(), frame_host_); |
| 83 } | 80 } |
| 84 | 81 |
| 85 return service_registry_.get(); | 82 return service_registry_.get(); |
| 86 } | 83 } |
| 87 | 84 |
| 88 } // namespace content | 85 } // namespace content |
| OLD | NEW |