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