| 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/service_manager/service_manager_context.h" | 5 #include "content/browser/service_manager/service_manager_context.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/feature_list.h" | |
| 14 #include "base/json/json_reader.h" | 13 #include "base/json/json_reader.h" |
| 15 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
| 16 #include "base/macros.h" | 15 #include "base/macros.h" |
| 17 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
| 18 #include "base/process/process_handle.h" | 17 #include "base/process/process_handle.h" |
| 19 #include "base/single_thread_task_runner.h" | 18 #include "base/single_thread_task_runner.h" |
| 20 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
| 21 #include "content/browser/child_process_launcher.h" | 20 #include "content/browser/child_process_launcher.h" |
| 22 #include "content/browser/gpu/gpu_process_host.h" | 21 #include "content/browser/gpu/gpu_process_host.h" |
| 23 #include "content/browser/service_manager/common_browser_interfaces.h" | 22 #include "content/browser/service_manager/common_browser_interfaces.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 46 #include "services/resource_coordinator/public/cpp/resource_coordinator_features
.h" | 45 #include "services/resource_coordinator/public/cpp/resource_coordinator_features
.h" |
| 47 #include "services/resource_coordinator/public/interfaces/service_constants.mojo
m.h" | 46 #include "services/resource_coordinator/public/interfaces/service_constants.mojo
m.h" |
| 48 #include "services/resource_coordinator/resource_coordinator_service.h" | 47 #include "services/resource_coordinator/resource_coordinator_service.h" |
| 49 #include "services/service_manager/connect_params.h" | 48 #include "services/service_manager/connect_params.h" |
| 50 #include "services/service_manager/public/cpp/connector.h" | 49 #include "services/service_manager/public/cpp/connector.h" |
| 51 #include "services/service_manager/public/cpp/service.h" | 50 #include "services/service_manager/public/cpp/service.h" |
| 52 #include "services/service_manager/public/interfaces/service.mojom.h" | 51 #include "services/service_manager/public/interfaces/service.mojom.h" |
| 53 #include "services/service_manager/runner/common/client_util.h" | 52 #include "services/service_manager/runner/common/client_util.h" |
| 54 #include "services/service_manager/service_manager.h" | 53 #include "services/service_manager/service_manager.h" |
| 55 #include "services/shape_detection/public/interfaces/constants.mojom.h" | 54 #include "services/shape_detection/public/interfaces/constants.mojom.h" |
| 56 #include "services/video_capture/public/cpp/constants.h" | |
| 57 #include "services/video_capture/public/interfaces/constants.mojom.h" | |
| 58 | 55 |
| 59 #if defined(OS_ANDROID) | 56 #if defined(OS_ANDROID) |
| 60 #include "base/android/jni_android.h" | 57 #include "base/android/jni_android.h" |
| 61 #include "base/android/scoped_java_ref.h" | 58 #include "base/android/scoped_java_ref.h" |
| 62 #include "jni/ContentNfcDelegate_jni.h" | 59 #include "jni/ContentNfcDelegate_jni.h" |
| 63 #endif | 60 #endif |
| 64 | 61 |
| 65 namespace content { | 62 namespace content { |
| 66 | 63 |
| 67 namespace { | 64 namespace { |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 ->RegisterUnsandboxedOutOfProcessServices(&unsandboxed_services); | 357 ->RegisterUnsandboxedOutOfProcessServices(&unsandboxed_services); |
| 361 | 358 |
| 362 bool network_service_enabled = | 359 bool network_service_enabled = |
| 363 base::CommandLine::ForCurrentProcess()->HasSwitch( | 360 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 364 switches::kEnableNetworkService); | 361 switches::kEnableNetworkService); |
| 365 if (network_service_enabled) { | 362 if (network_service_enabled) { |
| 366 unsandboxed_services.insert( | 363 unsandboxed_services.insert( |
| 367 std::make_pair(content::mojom::kNetworkServiceName, | 364 std::make_pair(content::mojom::kNetworkServiceName, |
| 368 base::ASCIIToUTF16("Network Service"))); | 365 base::ASCIIToUTF16("Network Service"))); |
| 369 } | 366 } |
| 370 if (base::FeatureList::IsEnabled(video_capture::kMojoVideoCapture)) { | |
| 371 unsandboxed_services.insert( | |
| 372 std::make_pair(video_capture::mojom::kServiceName, | |
| 373 base::ASCIIToUTF16("Video Capture Service"))); | |
| 374 } | |
| 375 | 367 |
| 376 for (const auto& service : unsandboxed_services) { | 368 for (const auto& service : unsandboxed_services) { |
| 377 packaged_services_connection_->AddServiceRequestHandler( | 369 packaged_services_connection_->AddServiceRequestHandler( |
| 378 service.first, base::Bind(&StartServiceInUtilityProcess, service.first, | 370 service.first, base::Bind(&StartServiceInUtilityProcess, service.first, |
| 379 service.second, false /* use_sandbox */)); | 371 service.second, false /* use_sandbox */)); |
| 380 } | 372 } |
| 381 | 373 |
| 382 #if BUILDFLAG(ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) | 374 #if BUILDFLAG(ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) |
| 383 packaged_services_connection_->AddServiceRequestHandler( | 375 packaged_services_connection_->AddServiceRequestHandler( |
| 384 "media", base::Bind(&StartServiceInGpuProcess, "media")); | 376 "media", base::Bind(&StartServiceInGpuProcess, "media")); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 415 base::Bind(&DestroyConnectorOnIOThread)); | 407 base::Bind(&DestroyConnectorOnIOThread)); |
| 416 } | 408 } |
| 417 | 409 |
| 418 // static | 410 // static |
| 419 service_manager::Connector* ServiceManagerContext::GetConnectorForIOThread() { | 411 service_manager::Connector* ServiceManagerContext::GetConnectorForIOThread() { |
| 420 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 412 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 421 return g_io_thread_connector.Get().get(); | 413 return g_io_thread_connector.Get().get(); |
| 422 } | 414 } |
| 423 | 415 |
| 424 } // namespace content | 416 } // namespace content |
| OLD | NEW |