Chromium Code Reviews| 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/bind.h" | |
| 9 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| 10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 11 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 12 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
| 13 #include "base/thread_task_runner_handle.h" | 14 #include "base/thread_task_runner_handle.h" |
| 15 #include "components/filesystem/file_system_app.h" | |
| 16 #include "components/leveldb/leveldb_app.h" | |
| 14 #include "content/browser/gpu/gpu_process_host.h" | 17 #include "content/browser/gpu/gpu_process_host.h" |
| 15 #include "content/common/gpu/gpu_process_launch_causes.h" | 18 #include "content/common/gpu/gpu_process_launch_causes.h" |
| 16 #include "content/common/mojo/static_application_loader.h" | 19 #include "content/common/mojo/static_application_loader.h" |
| 17 #include "content/common/process_control.mojom.h" | 20 #include "content/common/process_control.mojom.h" |
| 18 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
| 19 #include "content/public/browser/content_browser_client.h" | 22 #include "content/public/browser/content_browser_client.h" |
| 20 #include "content/public/browser/utility_process_host.h" | 23 #include "content/public/browser/utility_process_host.h" |
| 21 #include "content/public/browser/utility_process_host_client.h" | 24 #include "content/public/browser/utility_process_host_client.h" |
| 22 #include "content/public/common/content_client.h" | 25 #include "content/public/common/content_client.h" |
| 23 #include "content/public/common/service_registry.h" | 26 #include "content/public/common/service_registry.h" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 242 scoped_ptr<mojo::shell::ApplicationLoader>( | 245 scoped_ptr<mojo::shell::ApplicationLoader>( |
| 243 new UtilityProcessLoader(app.second, false /* use_sandbox */)), | 246 new UtilityProcessLoader(app.second, false /* use_sandbox */)), |
| 244 app.first); | 247 app.first); |
| 245 } | 248 } |
| 246 | 249 |
| 247 #if (ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) | 250 #if (ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) |
| 248 application_manager_->SetLoaderForURL( | 251 application_manager_->SetLoaderForURL( |
| 249 scoped_ptr<mojo::shell::ApplicationLoader>(new GpuProcessLoader()), | 252 scoped_ptr<mojo::shell::ApplicationLoader>(new GpuProcessLoader()), |
| 250 GURL("mojo:media")); | 253 GURL("mojo:media")); |
| 251 #endif | 254 #endif |
| 255 | |
| 256 // This starts the filesystem stuff, but it immediately breaks due to | |
| 257 // the capability filter preventing filesystem from contacting tracing. | |
| 258 base::FilePath path = | |
| 259 base::FilePath::FromUTF8Unsafe("/work/chrome/tmp_profile"); | |
|
Elliot Glaysher
2016/02/25 23:16:12
So my current big question is how do I safely get
| |
| 260 base::Callback<scoped_ptr<mojo::ShellClient>()> fs_callback = | |
| 261 base::Bind(&filesystem::CreateFileSystemApp, path); | |
| 262 application_manager_->SetLoaderForURL( | |
| 263 scoped_ptr<mojo::shell::ApplicationLoader>( | |
| 264 new StaticApplicationLoader(fs_callback)), | |
| 265 GURL("mojo:filesystem")); | |
| 266 | |
| 267 base::Callback<scoped_ptr<mojo::ShellClient>()> leveldb_callback = | |
| 268 base::Bind(&leveldb::CreateLevelDBApp); | |
| 269 application_manager_->SetLoaderForURL( | |
| 270 scoped_ptr<mojo::shell::ApplicationLoader>( | |
| 271 new StaticApplicationLoader(leveldb_callback)), | |
| 272 GURL("mojo:leveldb")); | |
| 252 } | 273 } |
| 253 | 274 |
| 254 MojoShellContext::~MojoShellContext() { | 275 MojoShellContext::~MojoShellContext() { |
| 255 } | 276 } |
| 256 | 277 |
| 257 // static | 278 // static |
| 258 void MojoShellContext::ConnectToApplication( | 279 void MojoShellContext::ConnectToApplication( |
| 259 const GURL& url, | 280 const GURL& url, |
| 260 const GURL& requestor_url, | 281 const GURL& requestor_url, |
| 261 mojo::shell::mojom::InterfaceProviderRequest request, | 282 mojo::shell::mojom::InterfaceProviderRequest request, |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 282 params->set_source(source_id); | 303 params->set_source(source_id); |
| 283 params->set_target(mojo::shell::Identity( | 304 params->set_target(mojo::shell::Identity( |
| 284 url, std::string(), mojo::shell::mojom::Connector::kUserRoot)); | 305 url, std::string(), mojo::shell::mojom::Connector::kUserRoot)); |
| 285 params->set_remote_interfaces(std::move(request)); | 306 params->set_remote_interfaces(std::move(request)); |
| 286 params->set_local_interfaces(std::move(exposed_services)); | 307 params->set_local_interfaces(std::move(exposed_services)); |
| 287 params->set_connect_callback(callback); | 308 params->set_connect_callback(callback); |
| 288 application_manager_->Connect(std::move(params)); | 309 application_manager_->Connect(std::move(params)); |
| 289 } | 310 } |
| 290 | 311 |
| 291 } // namespace content | 312 } // namespace content |
| OLD | NEW |