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" |
| 6 |
5 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> |
6 | 9 |
7 #include "base/macros.h" | 10 #include "base/macros.h" |
8 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
9 #include "base/thread_task_runner_handle.h" | 12 #include "base/thread_task_runner_handle.h" |
10 #include "build/build_config.h" | 13 #include "build/build_config.h" |
11 #include "content/browser/mojo/mojo_shell_client_host.h" | |
12 #include "content/common/mojo/mojo_messages.h" | 14 #include "content/common/mojo/mojo_messages.h" |
13 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
14 #include "content/public/browser/render_process_host.h" | 16 #include "content/public/browser/render_process_host.h" |
15 #include "content/public/common/mojo_shell_connection.h" | 17 #include "content/public/common/mojo_shell_connection.h" |
16 #include "ipc/ipc_sender.h" | 18 #include "ipc/ipc_sender.h" |
17 #include "mojo/application/public/cpp/application_impl.h" | 19 #include "mojo/application/public/cpp/application_impl.h" |
18 #include "mojo/application/public/interfaces/application_manager.mojom.h" | 20 #include "mojo/application/public/interfaces/application_manager.mojom.h" |
19 #include "mojo/converters/network/network_type_converters.h" | 21 #include "mojo/converters/network/network_type_converters.h" |
20 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h" | 22 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h" |
21 #include "third_party/mojo/src/mojo/edk/embedder/platform_channel_pair.h" | 23 #include "third_party/mojo/src/mojo/edk/embedder/platform_channel_pair.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 return; | 98 return; |
97 | 99 |
98 // Create the channel to be shared with the target process. | 100 // Create the channel to be shared with the target process. |
99 mojo::embedder::HandlePassingInformation handle_passing_info; | 101 mojo::embedder::HandlePassingInformation handle_passing_info; |
100 mojo::embedder::PlatformChannelPair platform_channel_pair; | 102 mojo::embedder::PlatformChannelPair platform_channel_pair; |
101 | 103 |
102 // Give one end to the shell so that it can create an instance. | 104 // Give one end to the shell so that it can create an instance. |
103 mojo::embedder::ScopedPlatformHandle platform_channel = | 105 mojo::embedder::ScopedPlatformHandle platform_channel = |
104 platform_channel_pair.PassServerHandle(); | 106 platform_channel_pair.PassServerHandle(); |
105 mojo::ScopedMessagePipeHandle handle(mojo::embedder::CreateChannel( | 107 mojo::ScopedMessagePipeHandle handle(mojo::embedder::CreateChannel( |
106 platform_channel.Pass(), base::Bind(&DidCreateChannel), | 108 std::move(platform_channel), base::Bind(&DidCreateChannel), |
107 base::ThreadTaskRunnerHandle::Get())); | 109 base::ThreadTaskRunnerHandle::Get())); |
108 mojo::shell::mojom::ApplicationManagerPtr application_manager; | 110 mojo::shell::mojom::ApplicationManagerPtr application_manager; |
109 MojoShellConnection::Get()->GetApplication()->ConnectToService( | 111 MojoShellConnection::Get()->GetApplication()->ConnectToService( |
110 "mojo:shell", &application_manager); | 112 "mojo:shell", &application_manager); |
111 // The content of the URL/qualifier we pass is actually meaningless, it's only | 113 // The content of the URL/qualifier we pass is actually meaningless, it's only |
112 // important that they're unique per process. | 114 // important that they're unique per process. |
113 // TODO(beng): We need to specify a restrictive CapabilityFilter here that | 115 // TODO(beng): We need to specify a restrictive CapabilityFilter here that |
114 // matches the needs of the target process. Figure out where that | 116 // matches the needs of the target process. Figure out where that |
115 // specification is best determined (not here, this is a common | 117 // specification is best determined (not here, this is a common |
116 // chokepoint for all process types) and how to wire it through. | 118 // chokepoint for all process types) and how to wire it through. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 BrowserThread::UI, | 169 BrowserThread::UI, |
168 FROM_HERE, | 170 FROM_HERE, |
169 base::Bind(CallRegisterProcessWithBroker, pid, | 171 base::Bind(CallRegisterProcessWithBroker, pid, |
170 platform_handle_wrapper)); | 172 platform_handle_wrapper)); |
171 } | 173 } |
172 | 174 |
173 return platform_channel_pair.PassClientHandle(); | 175 return platform_channel_pair.PassClientHandle(); |
174 } | 176 } |
175 | 177 |
176 } // namespace content | 178 } // namespace content |
OLD | NEW |