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

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

Issue 2166953006: Eliminate FrameMojoShell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/browser/frame_host/frame_mojo_shell.h"
6
7 #include <utility>
8
9 #include "build/build_config.h"
10 #include "content/browser/mojo/mojo_shell_context.h"
11 #include "content/public/browser/content_browser_client.h"
12 #include "content/public/browser/render_frame_host.h"
13 #include "content/public/browser/render_process_host.h"
14 #include "content/public/browser/site_instance.h"
15 #include "content/public/common/content_client.h"
16 #include "services/shell/public/cpp/interface_registry.h"
17
18 #if defined(OS_ANDROID) && defined(ENABLE_MOJO_CDM)
19 #include "content/browser/media/android/provision_fetcher_impl.h"
20 #endif
21
22 namespace content {
23
24 namespace {
25
26 void RegisterFrameMojoShellInterfaces(shell::InterfaceRegistry* registry,
27 RenderFrameHost* render_frame_host) {
28 #if defined(OS_ANDROID) && defined(ENABLE_MOJO_CDM)
29 registry->AddInterface(
30 base::Bind(&ProvisionFetcherImpl::Create, render_frame_host));
31 #endif
32 }
33
34 } // namespace
35
36 FrameMojoShell::FrameMojoShell(RenderFrameHost* frame_host)
37 : frame_host_(frame_host) {
38 }
39
40 FrameMojoShell::~FrameMojoShell() {
41 }
42
43 void FrameMojoShell::BindRequest(shell::mojom::ConnectorRequest request) {
44 connectors_.AddBinding(this, std::move(request));
45 }
46
47 // TODO(xhwang): Currently no callers are exposing |exposed_interfaces|. So we
48 // drop it and replace it with interfaces we provide in the browser. In the
49 // future we may need to support both.
50 void FrameMojoShell::Connect(
51 shell::mojom::IdentityPtr target,
52 shell::mojom::InterfaceProviderRequest interfaces,
53 shell::mojom::InterfaceProviderPtr /* exposed_interfaces */,
54 shell::mojom::ClientProcessConnectionPtr client_process_connection,
55 const shell::mojom::Connector::ConnectCallback& callback) {
56 shell::mojom::InterfaceProviderPtr frame_interfaces;
57 interface_provider_bindings_.AddBinding(GetInterfaceRegistry(),
58 GetProxy(&frame_interfaces));
59 MojoShellContext::ConnectToApplication(
60 shell::mojom::kRootUserID, target->name,
61 frame_host_->GetSiteInstance()->GetSiteURL().spec(),
62 std::move(interfaces),
63 std::move(frame_interfaces), callback);
64 }
65
66 void FrameMojoShell::Clone(shell::mojom::ConnectorRequest request) {
67 connectors_.AddBinding(this, std::move(request));
68 }
69
70 shell::InterfaceRegistry* FrameMojoShell::GetInterfaceRegistry() {
71 if (!interface_registry_) {
72 interface_registry_.reset(new shell::InterfaceRegistry(nullptr));
73
74 // TODO(rockot/xhwang): Currently all applications connected share the same
75 // set of interfaces registered in the |registry|. We may want to provide
76 // different interfaces for different apps for better isolation.
77 RegisterFrameMojoShellInterfaces(interface_registry_.get(), frame_host_);
78 GetContentClient()->browser()->RegisterFrameMojoShellInterfaces(
79 interface_registry_.get(), frame_host_);
80 }
81
82 return interface_registry_.get();
83 }
84
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