| 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" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "mojo/common/url_type_converters.h" | 23 #include "mojo/common/url_type_converters.h" |
| 24 #include "mojo/public/cpp/bindings/interface_request.h" | 24 #include "mojo/public/cpp/bindings/interface_request.h" |
| 25 #include "mojo/public/cpp/bindings/string.h" | 25 #include "mojo/public/cpp/bindings/string.h" |
| 26 #include "mojo/shell/application_loader.h" | 26 #include "mojo/shell/application_loader.h" |
| 27 #include "mojo/shell/connect_to_application_params.h" | 27 #include "mojo/shell/connect_to_application_params.h" |
| 28 #include "mojo/shell/identity.h" | 28 #include "mojo/shell/identity.h" |
| 29 #include "mojo/shell/package_manager/package_manager_impl.h" | 29 #include "mojo/shell/package_manager/package_manager_impl.h" |
| 30 #include "mojo/shell/public/cpp/application_delegate.h" | 30 #include "mojo/shell/public/cpp/application_delegate.h" |
| 31 #include "mojo/shell/static_application_loader.h" | 31 #include "mojo/shell/static_application_loader.h" |
| 32 | 32 |
| 33 #if defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) || \ | |
| 34 defined(ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) | |
| 35 #include "media/mojo/services/mojo_media_application.h" | |
| 36 #endif | |
| 37 | |
| 38 namespace content { | 33 namespace content { |
| 39 | 34 |
| 40 namespace { | 35 namespace { |
| 41 | 36 |
| 42 // An extra set of apps to register on initialization, if set by a test. | 37 // An extra set of apps to register on initialization, if set by a test. |
| 43 const MojoShellContext::StaticApplicationMap* g_applications_for_test; | 38 const MojoShellContext::StaticApplicationMap* g_applications_for_test; |
| 44 | 39 |
| 45 void StartUtilityProcessOnIOThread( | 40 void StartUtilityProcessOnIOThread( |
| 46 mojo::InterfaceRequest<ProcessControl> request, | 41 mojo::InterfaceRequest<ProcessControl> request, |
| 47 const base::string16& process_name, | 42 const base::string16& process_name, |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 GetContentClient() | 239 GetContentClient() |
| 245 ->browser() | 240 ->browser() |
| 246 ->RegisterUnsandboxedOutOfProcessMojoApplications(&unsandboxed_apps); | 241 ->RegisterUnsandboxedOutOfProcessMojoApplications(&unsandboxed_apps); |
| 247 for (const auto& app : unsandboxed_apps) { | 242 for (const auto& app : unsandboxed_apps) { |
| 248 application_manager_->SetLoaderForURL( | 243 application_manager_->SetLoaderForURL( |
| 249 scoped_ptr<mojo::shell::ApplicationLoader>( | 244 scoped_ptr<mojo::shell::ApplicationLoader>( |
| 250 new UtilityProcessLoader(app.second, false /* use_sandbox */)), | 245 new UtilityProcessLoader(app.second, false /* use_sandbox */)), |
| 251 app.first); | 246 app.first); |
| 252 } | 247 } |
| 253 | 248 |
| 254 #if (ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) | 249 #if (ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) |
| 255 application_manager_->SetLoaderForURL( | |
| 256 scoped_ptr<mojo::shell::ApplicationLoader>( | |
| 257 new mojo::shell::StaticApplicationLoader( | |
| 258 base::Bind(&media::MojoMediaApplication::CreateApp))), | |
| 259 GURL("mojo:media")); | |
| 260 #elif(ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) | |
| 261 application_manager_->SetLoaderForURL( | 250 application_manager_->SetLoaderForURL( |
| 262 scoped_ptr<mojo::shell::ApplicationLoader>(new GpuProcessLoader()), | 251 scoped_ptr<mojo::shell::ApplicationLoader>(new GpuProcessLoader()), |
| 263 GURL("mojo:media")); | 252 GURL("mojo:media")); |
| 264 #endif | 253 #endif |
| 265 } | 254 } |
| 266 | 255 |
| 267 MojoShellContext::~MojoShellContext() { | 256 MojoShellContext::~MojoShellContext() { |
| 268 } | 257 } |
| 269 | 258 |
| 270 // static | 259 // static |
| (...skipping 23 matching lines...) Expand all Loading... |
| 294 mojo::shell::GetPermissiveCapabilityFilter())); | 283 mojo::shell::GetPermissiveCapabilityFilter())); |
| 295 params->SetTarget(mojo::shell::Identity(url, std::string(), filter)); | 284 params->SetTarget(mojo::shell::Identity(url, std::string(), filter)); |
| 296 params->set_services(std::move(request)); | 285 params->set_services(std::move(request)); |
| 297 params->set_exposed_services(std::move(exposed_services)); | 286 params->set_exposed_services(std::move(exposed_services)); |
| 298 params->set_on_application_end(base::Bind(&base::DoNothing)); | 287 params->set_on_application_end(base::Bind(&base::DoNothing)); |
| 299 params->set_connect_callback(callback); | 288 params->set_connect_callback(callback); |
| 300 application_manager_->ConnectToApplication(std::move(params)); | 289 application_manager_->ConnectToApplication(std::move(params)); |
| 301 } | 290 } |
| 302 | 291 |
| 303 } // namespace content | 292 } // namespace content |
| OLD | NEW |