| 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" | 12 #include "content/public/browser/browser_context.h" |
| 13 #include "content/public/browser/content_browser_client.h" | 13 #include "content/public/browser/content_browser_client.h" |
| 14 #include "content/public/browser/render_frame_host.h" | 14 #include "content/public/browser/render_frame_host.h" |
| 15 #include "content/public/browser/render_process_host.h" | 15 #include "content/public/browser/render_process_host.h" |
| 16 #include "content/public/browser/site_instance.h" | 16 #include "content/public/browser/site_instance.h" |
| 17 #include "content/public/common/content_client.h" | 17 #include "content/public/common/content_client.h" |
| 18 #include "mojo/common/url_type_converters.h" | 18 #include "mojo/common/url_type_converters.h" |
| 19 | 19 |
| 20 #if defined(OS_ANDROID) && defined(ENABLE_MOJO_CDM) | 20 #if defined(OS_ANDROID) && defined(ENABLE_MOJO_CDM) |
| 21 #include "content/browser/media/android/provision_fetcher_impl.h" | 21 #include "content/browser/media/android/provision_fetcher_impl.h" |
| 22 #include "content/browser/media/media_permission_impl.h" |
| 22 #endif | 23 #endif |
| 23 | 24 |
| 24 namespace content { | 25 namespace content { |
| 25 | 26 |
| 26 namespace { | 27 namespace { |
| 27 | 28 |
| 28 void RegisterFrameMojoShellServices(ServiceRegistry* registry, | 29 void RegisterFrameMojoShellServices( |
| 29 RenderFrameHost* render_frame_host) { | 30 ServiceRegistry* registry, |
| 31 RenderFrameHost* render_frame_host, |
| 32 PermissionServiceContext* permission_service_context) { |
| 30 #if defined(OS_ANDROID) && defined(ENABLE_MOJO_CDM) | 33 #if defined(OS_ANDROID) && defined(ENABLE_MOJO_CDM) |
| 31 LOG(ERROR) << __FUNCTION__; | |
| 32 registry->AddService( | 34 registry->AddService( |
| 33 base::Bind(&ProvisionFetcherImpl::Create, render_frame_host)); | 35 base::Bind(&ProvisionFetcherImpl::Create, render_frame_host)); |
| 36 registry->AddService( |
| 37 base::Bind(&MediaPermissionImpl::Create, permission_service_context)); |
| 34 #endif | 38 #endif |
| 35 } | 39 } |
| 36 | 40 |
| 37 } // namespace | 41 } // namespace |
| 38 | 42 |
| 39 FrameMojoShell::FrameMojoShell(RenderFrameHost* frame_host) | 43 FrameMojoShell::FrameMojoShell( |
| 40 : frame_host_(frame_host) { | 44 RenderFrameHost* frame_host, |
| 41 } | 45 PermissionServiceContext* permission_service_context) |
| 46 : frame_host_(frame_host), |
| 47 permission_service_context_(permission_service_context) {} |
| 42 | 48 |
| 43 FrameMojoShell::~FrameMojoShell() { | 49 FrameMojoShell::~FrameMojoShell() { |
| 44 } | 50 } |
| 45 | 51 |
| 46 void FrameMojoShell::BindRequest(mojo::shell::mojom::ConnectorRequest request) { | 52 void FrameMojoShell::BindRequest(mojo::shell::mojom::ConnectorRequest request) { |
| 47 connectors_.AddBinding(this, std::move(request)); | 53 connectors_.AddBinding(this, std::move(request)); |
| 48 } | 54 } |
| 49 | 55 |
| 50 // TODO(xhwang): Currently no callers are exposing |exposed_services|. So we | 56 // TODO(xhwang): Currently no callers are exposing |exposed_services|. So we |
| 51 // drop it and replace it with services we provide in the browser. In the | 57 // drop it and replace it with services we provide in the browser. In the |
| (...skipping 19 matching lines...) Expand all Loading... |
| 71 connectors_.AddBinding(this, std::move(request)); | 77 connectors_.AddBinding(this, std::move(request)); |
| 72 } | 78 } |
| 73 | 79 |
| 74 ServiceRegistryImpl* FrameMojoShell::GetServiceRegistry() { | 80 ServiceRegistryImpl* FrameMojoShell::GetServiceRegistry() { |
| 75 if (!service_registry_) { | 81 if (!service_registry_) { |
| 76 service_registry_.reset(new ServiceRegistryImpl()); | 82 service_registry_.reset(new ServiceRegistryImpl()); |
| 77 | 83 |
| 78 // TODO(rockot/xhwang): Currently all applications connected share the same | 84 // TODO(rockot/xhwang): Currently all applications connected share the same |
| 79 // set of services registered in the |registry|. We may want to provide | 85 // set of services registered in the |registry|. We may want to provide |
| 80 // different services for different apps for better isolation. | 86 // different services for different apps for better isolation. |
| 81 RegisterFrameMojoShellServices(service_registry_.get(), frame_host_); | 87 RegisterFrameMojoShellServices(service_registry_.get(), frame_host_, |
| 88 permission_service_context_); |
| 82 GetContentClient()->browser()->RegisterFrameMojoShellServices( | 89 GetContentClient()->browser()->RegisterFrameMojoShellServices( |
| 83 service_registry_.get(), frame_host_); | 90 service_registry_.get(), frame_host_); |
| 84 } | 91 } |
| 85 | 92 |
| 86 return service_registry_.get(); | 93 return service_registry_.get(); |
| 87 } | 94 } |
| 88 | 95 |
| 89 } // namespace content | 96 } // namespace content |
| OLD | NEW |