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_context.h" | 5 #include "content/browser/mojo/mojo_shell_context.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
13 #include "base/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
14 #include "components/profile_service/profile_app.h" | 14 #include "components/profile_service/profile_app.h" |
15 #include "content/browser/gpu/gpu_process_host.h" | 15 #include "content/browser/gpu/gpu_process_host.h" |
16 #include "content/common/gpu/gpu_process_launch_causes.h" | 16 #include "content/common/gpu/gpu_process_launch_causes.h" |
17 #include "content/common/mojo/mojo_shell_connection_impl.h" | 17 #include "content/common/mojo/mojo_shell_connection_impl.h" |
18 #include "content/common/mojo/static_loader.h" | 18 #include "content/common/mojo/static_loader.h" |
19 #include "content/common/process_control.mojom.h" | 19 #include "content/common/process_control.mojom.h" |
20 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
21 #include "content/public/browser/content_browser_client.h" | 21 #include "content/public/browser/content_browser_client.h" |
22 #include "content/public/browser/utility_process_host.h" | 22 #include "content/public/browser/utility_process_host.h" |
23 #include "content/public/browser/utility_process_host_client.h" | 23 #include "content/public/browser/utility_process_host_client.h" |
24 #include "content/public/common/content_client.h" | 24 #include "content/public/common/content_client.h" |
25 #include "content/public/common/service_registry.h" | 25 #include "content/public/common/service_registry.h" |
26 #include "mojo/public/cpp/bindings/interface_request.h" | 26 #include "mojo/public/cpp/bindings/interface_request.h" |
27 #include "mojo/public/cpp/bindings/string.h" | 27 #include "mojo/public/cpp/bindings/string.h" |
28 #include "mojo/services/catalog/owner.h" | 28 #include "mojo/services/catalog/factory.h" |
29 #include "mojo/services/catalog/store.h" | 29 #include "mojo/services/catalog/store.h" |
30 #include "mojo/shell/connect_params.h" | 30 #include "mojo/shell/connect_params.h" |
31 #include "mojo/shell/loader.h" | 31 #include "mojo/shell/loader.h" |
32 #include "mojo/shell/native_runner.h" | 32 #include "mojo/shell/native_runner.h" |
33 #include "mojo/shell/public/cpp/identity.h" | 33 #include "mojo/shell/public/cpp/identity.h" |
34 #include "mojo/shell/public/cpp/shell_client.h" | 34 #include "mojo/shell/public/cpp/shell_client.h" |
35 #include "mojo/shell/public/interfaces/connector.mojom.h" | 35 #include "mojo/shell/public/interfaces/connector.mojom.h" |
36 #include "mojo/shell/runner/host/in_process_native_runner.h" | 36 #include "mojo/shell/runner/host/in_process_native_runner.h" |
37 | 37 |
38 namespace content { | 38 namespace content { |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 } | 200 } |
201 | 201 |
202 MojoShellContext::MojoShellContext() { | 202 MojoShellContext::MojoShellContext() { |
203 proxy_.Get().reset(new Proxy(this)); | 203 proxy_.Get().reset(new Proxy(this)); |
204 | 204 |
205 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner = | 205 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner = |
206 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE); | 206 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE); |
207 scoped_ptr<mojo::shell::NativeRunnerFactory> native_runner_factory( | 207 scoped_ptr<mojo::shell::NativeRunnerFactory> native_runner_factory( |
208 new mojo::shell::InProcessNativeRunnerFactory( | 208 new mojo::shell::InProcessNativeRunnerFactory( |
209 BrowserThread::GetBlockingPool())); | 209 BrowserThread::GetBlockingPool())); |
210 catalog_.reset(new catalog::Owner(file_task_runner.get(), nullptr)); | 210 catalog_.reset(new catalog::Factory(file_task_runner.get(), nullptr)); |
211 shell_.reset(new mojo::shell::Shell(std::move(native_runner_factory), | 211 shell_.reset(new mojo::shell::Shell(std::move(native_runner_factory), |
212 catalog_->TakeShellClient())); | 212 catalog_->TakeShellClient())); |
213 | 213 |
214 shell_->set_default_loader( | 214 shell_->set_default_loader( |
215 scoped_ptr<mojo::shell::Loader>(new DefaultLoader)); | 215 scoped_ptr<mojo::shell::Loader>(new DefaultLoader)); |
216 | 216 |
217 StaticApplicationMap apps; | 217 StaticApplicationMap apps; |
218 GetContentClient()->browser()->RegisterInProcessMojoApplications(&apps); | 218 GetContentClient()->browser()->RegisterInProcessMojoApplications(&apps); |
219 if (g_applications_for_test) { | 219 if (g_applications_for_test) { |
220 // Add testing apps to the map, potentially overwriting whatever the | 220 // Add testing apps to the map, potentially overwriting whatever the |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 mojo::Identity source_id(requestor_name, mojo::shell::mojom::kRootUserID); | 291 mojo::Identity source_id(requestor_name, mojo::shell::mojom::kRootUserID); |
292 params->set_source(source_id); | 292 params->set_source(source_id); |
293 params->set_target(mojo::Identity(name, mojo::shell::mojom::kRootUserID)); | 293 params->set_target(mojo::Identity(name, mojo::shell::mojom::kRootUserID)); |
294 params->set_remote_interfaces(std::move(request)); | 294 params->set_remote_interfaces(std::move(request)); |
295 params->set_local_interfaces(std::move(exposed_services)); | 295 params->set_local_interfaces(std::move(exposed_services)); |
296 params->set_connect_callback(callback); | 296 params->set_connect_callback(callback); |
297 shell_->Connect(std::move(params)); | 297 shell_->Connect(std::move(params)); |
298 } | 298 } |
299 | 299 |
300 } // namespace content | 300 } // namespace content |
OLD | NEW |