Chromium Code Reviews| Index: content/browser/mojo/mojo_shell_context.cc |
| diff --git a/content/browser/mojo/mojo_shell_context.cc b/content/browser/mojo/mojo_shell_context.cc |
| index e048b49a673dc4100b4f6f1f99c466585c35e3ae..bf436e8fa4c85499d97c77e9756653f84e8db722 100644 |
| --- a/content/browser/mojo/mojo_shell_context.cc |
| +++ b/content/browser/mojo/mojo_shell_context.cc |
| @@ -13,6 +13,7 @@ |
| #include "base/thread_task_runner_handle.h" |
| #include "content/browser/gpu/gpu_process_host.h" |
| #include "content/common/gpu/gpu_process_launch_causes.h" |
| +#include "content/common/mojo/mojo_shell_connection_impl.h" |
| #include "content/common/mojo/static_application_loader.h" |
| #include "content/common/process_control.mojom.h" |
| #include "content/public/browser/browser_thread.h" |
| @@ -27,12 +28,17 @@ |
| #include "mojo/shell/application_loader.h" |
| #include "mojo/shell/connect_params.h" |
| #include "mojo/shell/identity.h" |
| +#include "mojo/shell/native_runner.h" |
| #include "mojo/shell/public/cpp/shell_client.h" |
| +#include "mojo/shell/public/interfaces/shell.mojom.h" |
| +#include "mojo/shell/runner/host/in_process_native_runner.h" |
| namespace content { |
| namespace { |
| +const char kBrowserAppUrl[] = "exe:chrome"; |
| + |
| // An extra set of apps to register on initialization, if set by a test. |
| const MojoShellContext::StaticApplicationMap* g_applications_for_test; |
| @@ -202,8 +208,12 @@ MojoShellContext::MojoShellContext() { |
| BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE); |
| bool register_mojo_url_schemes = false; |
| + scoped_ptr<mojo::shell::NativeRunnerFactory> native_runner_factory( |
| + new mojo::shell::InProcessNativeRunnerFactory( |
| + BrowserThread::GetBlockingPool())); |
| application_manager_.reset(new mojo::shell::ApplicationManager( |
| - nullptr, file_task_runner.get(), register_mojo_url_schemes)); |
| + std::move(native_runner_factory), file_task_runner.get(), |
| + register_mojo_url_schemes)); |
| application_manager_->set_default_loader( |
| scoped_ptr<mojo::shell::ApplicationLoader>(new DefaultApplicationLoader)); |
| @@ -250,6 +260,18 @@ MojoShellContext::MojoShellContext() { |
| scoped_ptr<mojo::shell::ApplicationLoader>(new GpuProcessLoader()), |
| GURL("mojo:media")); |
| #endif |
| + |
| + if (!IsRunningInMojoShell()) { |
| + scoped_ptr<mojo::shell::ConnectParams> params( |
| + new mojo::shell::ConnectParams); |
|
Ben Goodger (Google)
2016/02/25 03:02:58
you must always set a source.
Ken Rockot(use gerrit already)
2016/02/25 04:42:05
Ah right, so it doesn't even really make sense to
|
| + params->set_target( |
| + mojo::shell::Identity(GURL(kBrowserAppUrl), std::string(), |
| + mojo::shell::mojom::Shell::kUserRoot, |
| + mojo::shell::GetPermissiveCapabilityFilter())); |
| + |
| + MojoShellConnectionImpl::Create( |
| + application_manager_->CreateInstanceForURL(std::move(params))); |
| + } |
| } |
| MojoShellContext::~MojoShellContext() { |