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

Side by Side Diff: content/browser/mojo/mojo_shell_client_host.cc

Issue 1725353003: Eliminate mojo::Shell client lib class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@15connector
Patch Set: . Created 4 years, 10 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/mojo/mojo_shell_client_host.h" 5 #include "content/browser/mojo/mojo_shell_client_host.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
12 #include "base/thread_task_runner_handle.h" 12 #include "base/thread_task_runner_handle.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 #include "content/common/mojo/mojo_messages.h" 14 #include "content/common/mojo/mojo_messages.h"
15 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
16 #include "content/public/browser/render_process_host.h" 16 #include "content/public/browser/render_process_host.h"
17 #include "content/public/browser/render_process_host_observer.h" 17 #include "content/public/browser/render_process_host_observer.h"
18 #include "content/public/common/mojo_shell_connection.h" 18 #include "content/public/common/mojo_shell_connection.h"
19 #include "ipc/ipc_sender.h" 19 #include "ipc/ipc_sender.h"
20 #include "mojo/converters/network/network_type_converters.h" 20 #include "mojo/converters/network/network_type_converters.h"
21 #include "mojo/edk/embedder/embedder.h" 21 #include "mojo/edk/embedder/embedder.h"
22 #include "mojo/edk/embedder/platform_channel_pair.h" 22 #include "mojo/edk/embedder/platform_channel_pair.h"
23 #include "mojo/edk/embedder/scoped_platform_handle.h" 23 #include "mojo/edk/embedder/scoped_platform_handle.h"
24 #include "mojo/shell/public/cpp/shell.h" 24 #include "mojo/shell/public/cpp/connector.h"
25 #include "mojo/shell/public/interfaces/application_manager.mojom.h" 25 #include "mojo/shell/public/interfaces/application_manager.mojom.h"
26 26
27 namespace content { 27 namespace content {
28 namespace { 28 namespace {
29 29
30 const char kMojoShellInstanceURL[] = "mojo_shell_instance_url"; 30 const char kMojoShellInstanceURL[] = "mojo_shell_instance_url";
31 const char kMojoPlatformFile[] = "mojo_platform_file"; 31 const char kMojoPlatformFile[] = "mojo_platform_file";
32 32
33 base::PlatformFile PlatformFileFromScopedPlatformHandle( 33 base::PlatformFile PlatformFileFromScopedPlatformHandle(
34 mojo::edk::ScopedPlatformHandle handle) { 34 mojo::edk::ScopedPlatformHandle handle) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 // Send the other end to the child via Chrome IPC. 128 // Send the other end to the child via Chrome IPC.
129 base::PlatformFile client_file = PlatformFileFromScopedPlatformHandle( 129 base::PlatformFile client_file = PlatformFileFromScopedPlatformHandle(
130 platform_channel_pair.PassClientHandle()); 130 platform_channel_pair.PassClientHandle());
131 SetMojoPlatformFile(render_process_host, client_file); 131 SetMojoPlatformFile(render_process_host, client_file);
132 132
133 mojo::ScopedMessagePipeHandle request_pipe = 133 mojo::ScopedMessagePipeHandle request_pipe =
134 mojo::edk::CreateMessagePipe(std::move(parent_pipe)); 134 mojo::edk::CreateMessagePipe(std::move(parent_pipe));
135 135
136 mojo::shell::mojom::ApplicationManagerPtr application_manager; 136 mojo::shell::mojom::ApplicationManagerPtr application_manager;
137 MojoShellConnection::Get()->GetShell()->ConnectToInterface( 137 MojoShellConnection::Get()->GetConnector()->ConnectToInterface(
138 "mojo:shell", &application_manager); 138 "mojo:shell", &application_manager);
139 139
140 // The content of the URL/qualifier we pass is actually meaningless, it's only 140 // The content of the URL/qualifier we pass is actually meaningless, it's only
141 // important that they're unique per process. 141 // important that they're unique per process.
142 // TODO(beng): We need to specify a restrictive CapabilityFilter here that 142 // TODO(beng): We need to specify a restrictive CapabilityFilter here that
143 // matches the needs of the target process. Figure out where that 143 // matches the needs of the target process. Figure out where that
144 // specification is best determined (not here, this is a common 144 // specification is best determined (not here, this is a common
145 // chokepoint for all process types) and how to wire it through. 145 // chokepoint for all process types) and how to wire it through.
146 // http://crbug.com/555393 146 // http://crbug.com/555393
147 std::string url = base::StringPrintf( 147 std::string url = base::StringPrintf(
(...skipping 27 matching lines...) Expand all
175 RenderProcessHost* render_process_host) { 175 RenderProcessHost* render_process_host) {
176 InstanceShellHandle* client_file = static_cast<InstanceShellHandle*>( 176 InstanceShellHandle* client_file = static_cast<InstanceShellHandle*>(
177 render_process_host->GetUserData(kMojoPlatformFile)); 177 render_process_host->GetUserData(kMojoPlatformFile));
178 if (!client_file) 178 if (!client_file)
179 return; 179 return;
180 render_process_host->Send(new MojoMsg_BindExternalMojoShellHandle( 180 render_process_host->Send(new MojoMsg_BindExternalMojoShellHandle(
181 IPC::GetFileHandleForProcess(client_file->get(), process_handle, true))); 181 IPC::GetFileHandleForProcess(client_file->get(), process_handle, true)));
182 } 182 }
183 183
184 } // namespace content 184 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_main_loop.cc ('k') | content/browser/renderer_host/render_widget_host_view_mus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698