| 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 <unordered_map> | 7 #include <unordered_map> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
| 15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
| 16 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
| 17 #include "base/thread_task_runner_handle.h" | 17 #include "base/thread_task_runner_handle.h" |
| 18 #include "components/profile_service/public/cpp/constants.h" | |
| 19 #include "content/browser/gpu/gpu_process_host.h" | 18 #include "content/browser/gpu/gpu_process_host.h" |
| 20 #include "content/browser/mojo/constants.h" | 19 #include "content/browser/mojo/constants.h" |
| 21 #include "content/common/gpu_process_launch_causes.h" | 20 #include "content/common/gpu_process_launch_causes.h" |
| 22 #include "content/common/mojo/mojo_shell_connection_impl.h" | 21 #include "content/common/mojo/mojo_shell_connection_impl.h" |
| 23 #include "content/common/mojo/static_loader.h" | 22 #include "content/common/mojo/static_loader.h" |
| 24 #include "content/common/process_control.mojom.h" | 23 #include "content/common/process_control.mojom.h" |
| 25 #include "content/grit/content_resources.h" | 24 #include "content/grit/content_resources.h" |
| 26 #include "content/public/browser/browser_thread.h" | 25 #include "content/public/browser/browser_thread.h" |
| 27 #include "content/public/browser/content_browser_client.h" | 26 #include "content/public/browser/content_browser_client.h" |
| 28 #include "content/public/browser/utility_process_host.h" | 27 #include "content/public/browser/utility_process_host.h" |
| 29 #include "content/public/browser/utility_process_host_client.h" | 28 #include "content/public/browser/utility_process_host_client.h" |
| 30 #include "content/public/common/content_client.h" | 29 #include "content/public/common/content_client.h" |
| 31 #include "content/public/common/content_switches.h" | 30 #include "content/public/common/content_switches.h" |
| 32 #include "content/public/common/service_registry.h" | 31 #include "content/public/common/service_registry.h" |
| 33 #include "mojo/public/cpp/bindings/interface_request.h" | 32 #include "mojo/public/cpp/bindings/interface_request.h" |
| 34 #include "mojo/public/cpp/bindings/string.h" | 33 #include "mojo/public/cpp/bindings/string.h" |
| 35 #include "services/catalog/factory.h" | 34 #include "services/catalog/factory.h" |
| 36 #include "services/catalog/manifest_provider.h" | 35 #include "services/catalog/manifest_provider.h" |
| 37 #include "services/catalog/store.h" | 36 #include "services/catalog/store.h" |
| 38 #include "services/shell/connect_params.h" | 37 #include "services/shell/connect_params.h" |
| 39 #include "services/shell/loader.h" | 38 #include "services/shell/loader.h" |
| 40 #include "services/shell/native_runner.h" | 39 #include "services/shell/native_runner.h" |
| 41 #include "services/shell/public/cpp/identity.h" | 40 #include "services/shell/public/cpp/identity.h" |
| 42 #include "services/shell/public/cpp/shell_client.h" | 41 #include "services/shell/public/cpp/shell_client.h" |
| 43 #include "services/shell/public/interfaces/connector.mojom.h" | 42 #include "services/shell/public/interfaces/connector.mojom.h" |
| 44 #include "services/shell/runner/host/in_process_native_runner.h" | 43 #include "services/shell/runner/host/in_process_native_runner.h" |
| 44 #include "services/user/public/cpp/constants.h" |
| 45 | 45 |
| 46 namespace content { | 46 namespace content { |
| 47 | 47 |
| 48 namespace { | 48 namespace { |
| 49 | 49 |
| 50 // An extra set of apps to register on initialization, if set by a test. | 50 // An extra set of apps to register on initialization, if set by a test. |
| 51 const MojoShellContext::StaticApplicationMap* g_applications_for_test; | 51 const MojoShellContext::StaticApplicationMap* g_applications_for_test; |
| 52 | 52 |
| 53 void StartUtilityProcessOnIOThread( | 53 void StartUtilityProcessOnIOThread( |
| 54 mojo::InterfaceRequest<mojom::ProcessControl> request, | 54 mojo::InterfaceRequest<mojom::ProcessControl> request, |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 new mojo::shell::InProcessNativeRunnerFactory( | 234 new mojo::shell::InProcessNativeRunnerFactory( |
| 235 BrowserThread::GetBlockingPool())); | 235 BrowserThread::GetBlockingPool())); |
| 236 | 236 |
| 237 manifest_provider_.reset(new BuiltinManifestProvider); | 237 manifest_provider_.reset(new BuiltinManifestProvider); |
| 238 manifest_provider_->AddManifestResource(kBrowserMojoApplicationName, | 238 manifest_provider_->AddManifestResource(kBrowserMojoApplicationName, |
| 239 IDR_MOJO_CONTENT_BROWSER_MANIFEST); | 239 IDR_MOJO_CONTENT_BROWSER_MANIFEST); |
| 240 manifest_provider_->AddManifestResource(kRendererMojoApplicationName, | 240 manifest_provider_->AddManifestResource(kRendererMojoApplicationName, |
| 241 IDR_MOJO_CONTENT_RENDERER_MANIFEST); | 241 IDR_MOJO_CONTENT_RENDERER_MANIFEST); |
| 242 manifest_provider_->AddManifestResource("mojo:catalog", | 242 manifest_provider_->AddManifestResource("mojo:catalog", |
| 243 IDR_MOJO_CATALOG_MANIFEST); | 243 IDR_MOJO_CATALOG_MANIFEST); |
| 244 manifest_provider_->AddManifestResource(profile::kProfileMojoApplicationName, | 244 manifest_provider_->AddManifestResource(user_service::kUserServiceName, |
| 245 IDR_MOJO_PROFILE_MANIFEST); | 245 IDR_MOJO_PROFILE_MANIFEST); |
| 246 | 246 |
| 247 catalog_.reset(new catalog::Factory(file_task_runner.get(), nullptr, | 247 catalog_.reset(new catalog::Factory(file_task_runner.get(), nullptr, |
| 248 manifest_provider_.get())); | 248 manifest_provider_.get())); |
| 249 shell_.reset(new mojo::shell::Shell(std::move(native_runner_factory), | 249 shell_.reset(new mojo::shell::Shell(std::move(native_runner_factory), |
| 250 catalog_->TakeShellClient())); | 250 catalog_->TakeShellClient())); |
| 251 | 251 |
| 252 StaticApplicationMap apps; | 252 StaticApplicationMap apps; |
| 253 GetContentClient()->browser()->RegisterInProcessMojoApplications(&apps); | 253 GetContentClient()->browser()->RegisterInProcessMojoApplications(&apps); |
| 254 if (g_applications_for_test) { | 254 if (g_applications_for_test) { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 mojo::Identity source_id(requestor_name, user_id); | 324 mojo::Identity source_id(requestor_name, user_id); |
| 325 params->set_source(source_id); | 325 params->set_source(source_id); |
| 326 params->set_target(mojo::Identity(name, user_id)); | 326 params->set_target(mojo::Identity(name, user_id)); |
| 327 params->set_remote_interfaces(std::move(request)); | 327 params->set_remote_interfaces(std::move(request)); |
| 328 params->set_local_interfaces(std::move(exposed_services)); | 328 params->set_local_interfaces(std::move(exposed_services)); |
| 329 params->set_connect_callback(callback); | 329 params->set_connect_callback(callback); |
| 330 shell_->Connect(std::move(params)); | 330 shell_->Connect(std::move(params)); |
| 331 } | 331 } |
| 332 | 332 |
| 333 } // namespace content | 333 } // namespace content |
| OLD | NEW |