[Video Capture Service, ChromeOS] Run video capture service in browser process

Before this CL, the video capture service, on ChromeOS, would run in a
separate utility process unless the HAL v3 service was being used.

This CL changes this so that on ChromeOS the video capture service always
runs in the browser process. This is to mitigate an issue with screen
rotation events only being available in the browser process.

Bug: 891961
Change-Id: I4764f7cf131fff819e9e0f726d45bb86af09ed9f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1506604
Commit-Queue: Christian Fremerey <chfremer@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Ricky Liang <jcliang@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#641024}(cherry picked from commit 40727b5f8eb1413cb11a09ae348a0794853095b9)
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1524034
Reviewed-by: Christian Fremerey <chfremer@chromium.org>
Cr-Commit-Position: refs/branch-heads/3683@{#826}
Cr-Branched-From: e51029943e0a38dd794b73caaf6373d5496ae783-refs/heads/master@{#625896}
diff --git a/content/browser/webrtc/webrtc_video_capture_browsertest.cc b/content/browser/webrtc/webrtc_video_capture_browsertest.cc
index 9e38210..a9eb78c 100644
--- a/content/browser/webrtc/webrtc_video_capture_browsertest.cc
+++ b/content/browser/webrtc/webrtc_video_capture_browsertest.cc
@@ -22,16 +22,6 @@
 
 namespace content {
 
-#if defined(OS_ANDROID)
-// Mojo video capture is currently not supported on Android
-// TODO(chfremer): Enable as soon as https://crbug.com/720500 is resolved.
-#define MAYBE_RecoverFromCrashInVideoCaptureProcess \
-  DISABLED_RecoverFromCrashInVideoCaptureProcess
-#else
-#define MAYBE_RecoverFromCrashInVideoCaptureProcess \
-  RecoverFromCrashInVideoCaptureProcess
-#endif  // defined(OS_ANDROID)
-
 namespace {
 
 static const char kVideoCaptureHtmlFile[] = "/media/video_capture_test.html";
@@ -63,6 +53,7 @@
   void SetUp() override {
     ASSERT_TRUE(embedded_test_server()->InitializeAndListen());
     EnablePixelOutput();
+    embedded_test_server()->StartAcceptingConnections();
     ContentBrowserTest::SetUp();
   }
 
@@ -73,8 +64,12 @@
 };
 
 IN_PROC_BROWSER_TEST_F(WebRtcVideoCaptureBrowserTest,
-                       MAYBE_RecoverFromCrashInVideoCaptureProcess) {
-  embedded_test_server()->StartAcceptingConnections();
+                       RecoverFromCrashInVideoCaptureProcess) {
+  // This test only makes sense if the video capture service runs in a
+  // separate process.
+  if (!features::IsVideoCaptureServiceEnabledForOutOfProcess())
+    return;
+
   GURL url(embedded_test_server()->GetURL(kVideoCaptureHtmlFile));
   NavigateToURL(shell(), url);
 
diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc
index 163f405..628f916 100644
--- a/content/public/common/content_features.cc
+++ b/content/public/common/content_features.cc
@@ -5,10 +5,6 @@
 #include "content/public/common/content_features.h"
 #include "build/build_config.h"
 
-#if defined(OS_CHROMEOS)
-#include "media/capture/video/chromeos/public/cros_features.h"
-#endif
-
 namespace features {
 
 // All features in alphabetical order.
@@ -723,12 +719,11 @@
   if (!ShouldEnableVideoCaptureService())
     return VideoCaptureServiceConfiguration::kDisabled;
 
-#if defined(OS_ANDROID)
+// On ChromeOS the service must run in the browser process, because parts of the
+// code depend on global objects that are only available in the Browser process.
+// See https://crbug.com/891961.
+#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
   return VideoCaptureServiceConfiguration::kEnabledForBrowserProcess;
-#elif defined(OS_CHROMEOS)
-  return media::ShouldUseCrosCameraService()
-             ? VideoCaptureServiceConfiguration::kEnabledForBrowserProcess
-             : VideoCaptureServiceConfiguration::kEnabledForOutOfProcess;
 #else
   return base::FeatureList::IsEnabled(
              features::kRunVideoCaptureServiceInBrowserProcess)