| 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 "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "mojo/application/public/cpp/application_delegate.h" | 21 #include "mojo/application/public/cpp/application_delegate.h" |
| 22 #include "mojo/common/url_type_converters.h" | 22 #include "mojo/common/url_type_converters.h" |
| 23 #include "mojo/package_manager/package_manager_impl.h" | 23 #include "mojo/package_manager/package_manager_impl.h" |
| 24 #include "mojo/shell/application_loader.h" | 24 #include "mojo/shell/application_loader.h" |
| 25 #include "mojo/shell/connect_to_application_params.h" | 25 #include "mojo/shell/connect_to_application_params.h" |
| 26 #include "mojo/shell/identity.h" | 26 #include "mojo/shell/identity.h" |
| 27 #include "mojo/shell/static_application_loader.h" | 27 #include "mojo/shell/static_application_loader.h" |
| 28 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h" | 28 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h" |
| 29 #include "third_party/mojo/src/mojo/public/cpp/bindings/string.h" | 29 #include "third_party/mojo/src/mojo/public/cpp/bindings/string.h" |
| 30 | 30 |
| 31 #if defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) | 31 #if defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) || \ |
| 32 defined(ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) |
| 32 #include "media/mojo/services/mojo_media_application.h" | 33 #include "media/mojo/services/mojo_media_application.h" |
| 33 #endif | 34 #endif |
| 34 | 35 |
| 35 namespace content { | 36 namespace content { |
| 36 | 37 |
| 37 namespace { | 38 namespace { |
| 38 | 39 |
| 39 // An extra set of apps to register on initialization, if set by a test. | 40 // An extra set of apps to register on initialization, if set by a test. |
| 40 const MojoShellContext::StaticApplicationMap* g_applications_for_test; | 41 const MojoShellContext::StaticApplicationMap* g_applications_for_test; |
| 41 | 42 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 scoped_ptr<mojo::shell::ApplicationLoader>( | 246 scoped_ptr<mojo::shell::ApplicationLoader>( |
| 246 new UtilityProcessLoader(app.second, false /* use_sandbox */)), | 247 new UtilityProcessLoader(app.second, false /* use_sandbox */)), |
| 247 app.first); | 248 app.first); |
| 248 } | 249 } |
| 249 | 250 |
| 250 #if (ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) | 251 #if (ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) |
| 251 application_manager_->SetLoaderForURL( | 252 application_manager_->SetLoaderForURL( |
| 252 scoped_ptr<mojo::shell::ApplicationLoader>( | 253 scoped_ptr<mojo::shell::ApplicationLoader>( |
| 253 new mojo::shell::StaticApplicationLoader( | 254 new mojo::shell::StaticApplicationLoader( |
| 254 base::Bind(&media::MojoMediaApplication::CreateApp))), | 255 base::Bind(&media::MojoMediaApplication::CreateApp))), |
| 255 media::MojoMediaApplication::AppUrl()); | 256 GURL("mojo:media")); |
| 257 #elif(ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) |
| 258 application_manager_->SetLoaderForURL( |
| 259 scoped_ptr<mojo::shell::ApplicationLoader>(new GpuProcessLoader()), |
| 260 GURL("mojo:media")); |
| 256 #endif | 261 #endif |
| 257 } | 262 } |
| 258 | 263 |
| 259 MojoShellContext::~MojoShellContext() { | 264 MojoShellContext::~MojoShellContext() { |
| 260 } | 265 } |
| 261 | 266 |
| 262 // static | 267 // static |
| 263 void MojoShellContext::ConnectToApplication( | 268 void MojoShellContext::ConnectToApplication( |
| 264 const GURL& url, | 269 const GURL& url, |
| 265 const GURL& requestor_url, | 270 const GURL& requestor_url, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 285 mojo::shell::GetPermissiveCapabilityFilter())); | 290 mojo::shell::GetPermissiveCapabilityFilter())); |
| 286 params->SetTarget(mojo::shell::Identity(url, std::string(), filter)); | 291 params->SetTarget(mojo::shell::Identity(url, std::string(), filter)); |
| 287 params->set_services(request.Pass()); | 292 params->set_services(request.Pass()); |
| 288 params->set_exposed_services(exposed_services.Pass()); | 293 params->set_exposed_services(exposed_services.Pass()); |
| 289 params->set_on_application_end(base::Bind(&base::DoNothing)); | 294 params->set_on_application_end(base::Bind(&base::DoNothing)); |
| 290 params->set_connect_callback(callback); | 295 params->set_connect_callback(callback); |
| 291 application_manager_->ConnectToApplication(params.Pass()); | 296 application_manager_->ConnectToApplication(params.Pass()); |
| 292 } | 297 } |
| 293 | 298 |
| 294 } // namespace content | 299 } // namespace content |
| OLD | NEW |