Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(417)

Side by Side Diff: content/browser/frame_host/frame_mojo_shell.cc

Issue 2079943002: Change RenderFrame to use InterfaceRegistry et al. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@a2
Patch Set: . Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
12 #include "content/public/browser/content_browser_client.h" 11 #include "content/public/browser/content_browser_client.h"
13 #include "content/public/browser/render_frame_host.h" 12 #include "content/public/browser/render_frame_host.h"
14 #include "content/public/browser/render_process_host.h" 13 #include "content/public/browser/render_process_host.h"
15 #include "content/public/browser/site_instance.h" 14 #include "content/public/browser/site_instance.h"
16 #include "content/public/common/content_client.h" 15 #include "content/public/common/content_client.h"
16 #include "services/shell/public/cpp/interface_registry.h"
17 17
18 #if defined(OS_ANDROID) && defined(ENABLE_MOJO_CDM) 18 #if defined(OS_ANDROID) && defined(ENABLE_MOJO_CDM)
19 #include "content/browser/media/android/provision_fetcher_impl.h" 19 #include "content/browser/media/android/provision_fetcher_impl.h"
20 #endif 20 #endif
21 21
22 namespace content { 22 namespace content {
23 23
24 namespace { 24 namespace {
25 25
26 void RegisterFrameMojoShellServices(ServiceRegistry* registry, 26 void RegisterFrameMojoShellInterfaces(shell::InterfaceRegistry* registry,
27 RenderFrameHost* render_frame_host) { 27 RenderFrameHost* render_frame_host) {
28 #if defined(OS_ANDROID) && defined(ENABLE_MOJO_CDM) 28 #if defined(OS_ANDROID) && defined(ENABLE_MOJO_CDM)
29 registry->AddService( 29 registry->AddInterface(
30 base::Bind(&ProvisionFetcherImpl::Create, render_frame_host)); 30 base::Bind(&ProvisionFetcherImpl::Create, render_frame_host));
31 #endif 31 #endif
32 } 32 }
33 33
34 } // namespace 34 } // namespace
35 35
36 FrameMojoShell::FrameMojoShell(RenderFrameHost* frame_host) 36 FrameMojoShell::FrameMojoShell(RenderFrameHost* frame_host)
37 : frame_host_(frame_host) { 37 : frame_host_(frame_host) {
38 } 38 }
39 39
40 FrameMojoShell::~FrameMojoShell() { 40 FrameMojoShell::~FrameMojoShell() {
41 } 41 }
42 42
43 void FrameMojoShell::BindRequest(shell::mojom::ConnectorRequest request) { 43 void FrameMojoShell::BindRequest(shell::mojom::ConnectorRequest request) {
44 connectors_.AddBinding(this, std::move(request)); 44 connectors_.AddBinding(this, std::move(request));
45 } 45 }
46 46
47 // TODO(xhwang): Currently no callers are exposing |exposed_services|. So we 47 // TODO(xhwang): Currently no callers are exposing |exposed_interfaces|. So we
48 // drop it and replace it with services we provide in the browser. In the 48 // drop it and replace it with interfaces we provide in the browser. In the
49 // future we may need to support both. 49 // future we may need to support both.
50 void FrameMojoShell::Connect( 50 void FrameMojoShell::Connect(
51 shell::mojom::IdentityPtr target, 51 shell::mojom::IdentityPtr target,
52 shell::mojom::InterfaceProviderRequest services, 52 shell::mojom::InterfaceProviderRequest interfaces,
53 shell::mojom::InterfaceProviderPtr /* exposed_services */, 53 shell::mojom::InterfaceProviderPtr /* exposed_interfaces */,
54 shell::mojom::ClientProcessConnectionPtr client_process_connection, 54 shell::mojom::ClientProcessConnectionPtr client_process_connection,
55 const shell::mojom::Connector::ConnectCallback& callback) { 55 const shell::mojom::Connector::ConnectCallback& callback) {
56 shell::mojom::InterfaceProviderPtr frame_services; 56 shell::mojom::InterfaceProviderPtr frame_interfaces;
57 service_provider_bindings_.AddBinding(GetServiceRegistry(), 57 interface_provider_bindings_.AddBinding(GetInterfaceRegistry(),
58 GetProxy(&frame_services)); 58 GetProxy(&frame_interfaces));
59 MojoShellContext::ConnectToApplication( 59 MojoShellContext::ConnectToApplication(
60 shell::mojom::kRootUserID, target->name, 60 shell::mojom::kRootUserID, target->name,
61 frame_host_->GetSiteInstance()->GetSiteURL().spec(), std::move(services), 61 frame_host_->GetSiteInstance()->GetSiteURL().spec(),
62 std::move(frame_services), callback); 62 std::move(interfaces),
63 std::move(frame_interfaces), callback);
63 } 64 }
64 65
65 void FrameMojoShell::Clone(shell::mojom::ConnectorRequest request) { 66 void FrameMojoShell::Clone(shell::mojom::ConnectorRequest request) {
66 connectors_.AddBinding(this, std::move(request)); 67 connectors_.AddBinding(this, std::move(request));
67 } 68 }
68 69
69 ServiceRegistryImpl* FrameMojoShell::GetServiceRegistry() { 70 shell::InterfaceRegistry* FrameMojoShell::GetInterfaceRegistry() {
70 if (!service_registry_) { 71 if (!interface_registry_) {
71 service_registry_.reset(new ServiceRegistryImpl()); 72 interface_registry_.reset(new shell::InterfaceRegistry(nullptr));
72 73
73 // TODO(rockot/xhwang): Currently all applications connected share the same 74 // TODO(rockot/xhwang): Currently all applications connected share the same
74 // set of services registered in the |registry|. We may want to provide 75 // set of interfaces registered in the |registry|. We may want to provide
75 // different services for different apps for better isolation. 76 // different interfaces for different apps for better isolation.
76 RegisterFrameMojoShellServices(service_registry_.get(), frame_host_); 77 RegisterFrameMojoShellInterfaces(interface_registry_.get(), frame_host_);
77 GetContentClient()->browser()->RegisterFrameMojoShellServices( 78 GetContentClient()->browser()->RegisterFrameMojoShellInterfaces(
78 service_registry_.get(), frame_host_); 79 interface_registry_.get(), frame_host_);
79 } 80 }
80 81
81 return service_registry_.get(); 82 return interface_registry_.get();
82 } 83 }
83 84
84 } // namespace content 85 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/frame_mojo_shell.h ('k') | content/browser/frame_host/render_frame_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698