| 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/shell/connect_params.h" | 28 #include "mojo/shell/connect_params.h" |
| 29 #include "mojo/shell/identity.h" | |
| 30 #include "mojo/shell/loader.h" | 29 #include "mojo/shell/loader.h" |
| 31 #include "mojo/shell/native_runner.h" | 30 #include "mojo/shell/native_runner.h" |
| 31 #include "mojo/shell/public/cpp/identity.h" |
| 32 #include "mojo/shell/public/cpp/shell_client.h" | 32 #include "mojo/shell/public/cpp/shell_client.h" |
| 33 #include "mojo/shell/public/interfaces/connector.mojom.h" | 33 #include "mojo/shell/public/interfaces/connector.mojom.h" |
| 34 #include "mojo/shell/runner/host/in_process_native_runner.h" | 34 #include "mojo/shell/runner/host/in_process_native_runner.h" |
| 35 | 35 |
| 36 namespace content { | 36 namespace content { |
| 37 | 37 |
| 38 namespace { | 38 namespace { |
| 39 | 39 |
| 40 const char kBrowserAppName[] = "exe:chrome"; | 40 const char kBrowserAppName[] = "exe:chrome"; |
| 41 | 41 |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 } | 278 } |
| 279 | 279 |
| 280 void MojoShellContext::ConnectToApplicationOnOwnThread( | 280 void MojoShellContext::ConnectToApplicationOnOwnThread( |
| 281 const std::string& name, | 281 const std::string& name, |
| 282 const std::string& requestor_name, | 282 const std::string& requestor_name, |
| 283 mojo::shell::mojom::InterfaceProviderRequest request, | 283 mojo::shell::mojom::InterfaceProviderRequest request, |
| 284 mojo::shell::mojom::InterfaceProviderPtr exposed_services, | 284 mojo::shell::mojom::InterfaceProviderPtr exposed_services, |
| 285 const mojo::shell::mojom::Connector::ConnectCallback& callback) { | 285 const mojo::shell::mojom::Connector::ConnectCallback& callback) { |
| 286 scoped_ptr<mojo::shell::ConnectParams> params(new mojo::shell::ConnectParams); | 286 scoped_ptr<mojo::shell::ConnectParams> params(new mojo::shell::ConnectParams); |
| 287 // TODO(beng): kRootUserID is obviously wrong. | 287 // TODO(beng): kRootUserID is obviously wrong. |
| 288 // TODO(beng): We need to set a permissive filter here temporarily because | 288 mojo::Identity source_id(requestor_name, mojo::shell::mojom::kRootUserID); |
| 289 // content is known as a bogus system: name that the application | |
| 290 // manager doesn't understand. | |
| 291 mojo::shell::Identity source_id( | |
| 292 requestor_name, std::string(), mojo::shell::mojom::kRootUserID); | |
| 293 source_id.set_filter(mojo::shell::GetPermissiveCapabilityFilter()); | |
| 294 params->set_source(source_id); | 289 params->set_source(source_id); |
| 295 params->set_target(mojo::shell::Identity( | 290 params->set_target(mojo::Identity(name, mojo::shell::mojom::kRootUserID)); |
| 296 name, std::string(), mojo::shell::mojom::kRootUserID)); | |
| 297 params->set_remote_interfaces(std::move(request)); | 291 params->set_remote_interfaces(std::move(request)); |
| 298 params->set_local_interfaces(std::move(exposed_services)); | 292 params->set_local_interfaces(std::move(exposed_services)); |
| 299 params->set_connect_callback(callback); | 293 params->set_connect_callback(callback); |
| 300 shell_->Connect(std::move(params)); | 294 shell_->Connect(std::move(params)); |
| 301 } | 295 } |
| 302 | 296 |
| 303 } // namespace content | 297 } // namespace content |
| OLD | NEW |