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/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/application_impl.h" | 24 #include "mojo/shell/public/cpp/shell.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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 112 |
113 void ConnectChildToShell( | 113 void ConnectChildToShell( |
114 int child_process_id, | 114 int child_process_id, |
115 base::WeakPtr<RenderProcessHost> render_process_host, | 115 base::WeakPtr<RenderProcessHost> render_process_host, |
116 mojo::InterfaceRequest<mojo::shell::mojom::PIDReceiver> request, | 116 mojo::InterfaceRequest<mojo::shell::mojom::PIDReceiver> request, |
117 mojo::ScopedMessagePipeHandle pipe) { | 117 mojo::ScopedMessagePipeHandle pipe) { |
118 if (!render_process_host) | 118 if (!render_process_host) |
119 return; | 119 return; |
120 | 120 |
121 mojo::shell::mojom::ApplicationManagerPtr application_manager; | 121 mojo::shell::mojom::ApplicationManagerPtr application_manager; |
122 MojoShellConnection::Get()->GetApplication()->ConnectToService( | 122 MojoShellConnection::Get()->GetShell()->ConnectToService( |
123 "mojo:shell", &application_manager); | 123 "mojo:shell", &application_manager); |
124 | 124 |
125 // The content of the URL/qualifier we pass is actually meaningless, it's only | 125 // The content of the URL/qualifier we pass is actually meaningless, it's only |
126 // important that they're unique per process. | 126 // important that they're unique per process. |
127 // TODO(beng): We need to specify a restrictive CapabilityFilter here that | 127 // TODO(beng): We need to specify a restrictive CapabilityFilter here that |
128 // matches the needs of the target process. Figure out where that | 128 // matches the needs of the target process. Figure out where that |
129 // specification is best determined (not here, this is a common | 129 // specification is best determined (not here, this is a common |
130 // chokepoint for all process types) and how to wire it through. | 130 // chokepoint for all process types) and how to wire it through. |
131 // http://crbug.com/555393 | 131 // http://crbug.com/555393 |
132 std::string url = | 132 std::string url = |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 RenderProcessHost* render_process_host) { | 200 RenderProcessHost* render_process_host) { |
201 InstanceShellHandle* client_file = static_cast<InstanceShellHandle*>( | 201 InstanceShellHandle* client_file = static_cast<InstanceShellHandle*>( |
202 render_process_host->GetUserData(kMojoPlatformFile)); | 202 render_process_host->GetUserData(kMojoPlatformFile)); |
203 if (!client_file) | 203 if (!client_file) |
204 return; | 204 return; |
205 render_process_host->Send(new MojoMsg_BindExternalMojoShellHandle( | 205 render_process_host->Send(new MojoMsg_BindExternalMojoShellHandle( |
206 IPC::GetFileHandleForProcess(client_file->get(), process_handle, true))); | 206 IPC::GetFileHandleForProcess(client_file->get(), process_handle, true))); |
207 } | 207 } |
208 | 208 |
209 } // namespace content | 209 } // namespace content |
OLD | NEW |