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