From 5329878a61e9cb15c8a23816a5b76eeb80cc76e8 Mon Sep 17 00:00:00 2001
From: Jun Ishiguro <junis@google.com>
Date: Mon, 13 Jan 2025 17:40:11 -0800
Subject: [PATCH] Move chrome/browser/ash/arc/video/ to
 chromeos/ash/experiences/arc/video

Bug: b:388689034
Change-Id: Id952c01f905de6b6b9ee2f7279b4e90b4a0887c6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6162057
Reviewed-by: Matthew Denton <mpdenton@chromium.org>
Reviewed-by: Hidehiko Abe <hidehiko@chromium.org>
Commit-Queue: Jun Ishiguro <junis@google.com>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1405847}
---
 chrome/browser/ash/arc/session/BUILD.gn       |  2 +-
 .../ash/arc/session/arc_service_launcher.cc   |  2 +-
 chrome/browser/ash/arc/video/DEPS             | 20 -------------------
 chrome/browser/ash/dbus/BUILD.gn              |  2 +-
 chrome/browser/ash/dbus/DEPS                  |  2 +-
 .../ash/dbus/libvda_service_provider.cc       |  2 +-
 .../ash/experiences}/arc/video/BUILD.gn       |  0
 chromeos/ash/experiences/arc/video/DEPS       |  3 +++
 .../ash/experiences}/arc/video/OWNERS         |  0
 .../arc/video/gpu_arc_video_service_host.cc   |  2 +-
 .../arc/video/gpu_arc_video_service_host.h    |  6 +++---
 ...dware_video_decoding_sandbox_hook_linux.cc |  8 ++++----
 ...dware_video_encoding_sandbox_hook_linux.cc |  8 ++++----
 ...pf_hardware_video_decoding_policy_linux.cc |  6 +++---
 14 files changed, 23 insertions(+), 40 deletions(-)
 delete mode 100644 chrome/browser/ash/arc/video/DEPS
 rename {chrome/browser/ash => chromeos/ash/experiences}/arc/video/BUILD.gn (100%)
 create mode 100644 chromeos/ash/experiences/arc/video/DEPS
 rename {chrome/browser/ash => chromeos/ash/experiences}/arc/video/OWNERS (100%)
 rename {chrome/browser/ash => chromeos/ash/experiences}/arc/video/gpu_arc_video_service_host.cc (99%)
 rename {chrome/browser/ash => chromeos/ash/experiences}/arc/video/gpu_arc_video_service_host.h (91%)

diff --git a/chrome/browser/ash/arc/session/BUILD.gn b/chrome/browser/ash/arc/session/BUILD.gn
index 135fd95c81a16..7b72ba2a464c3 100644
--- a/chrome/browser/ash/arc/session/BUILD.gn
+++ b/chrome/browser/ash/arc/session/BUILD.gn
@@ -83,7 +83,6 @@ static_library("session") {
     "//chrome/browser/ash/arc/tracing",
     "//chrome/browser/ash/arc/tts",
     "//chrome/browser/ash/arc/user_session",
-    "//chrome/browser/ash/arc/video",
     "//chrome/browser/ash/arc/vmm",
     "//chrome/browser/ash/arc/wallpaper",
     "//chrome/browser/ash/crostini",
@@ -118,6 +117,7 @@ static_library("session") {
     "//chromeos/ash/experiences/arc/intent_helper",
     "//chromeos/ash/experiences/arc/media_session",
     "//chromeos/ash/experiences/arc/oemcrypto",
+    "//chromeos/ash/experiences/arc/video",
     "//chromeos/ash/services/cros_healthd/public/cpp",
     "//chromeos/ash/services/cros_healthd/public/mojom",
     "//chromeos/dbus/tpm_manager",
diff --git a/chrome/browser/ash/arc/session/arc_service_launcher.cc b/chrome/browser/ash/arc/session/arc_service_launcher.cc
index 22dff282bf994..09434439c1e7d 100644
--- a/chrome/browser/ash/arc/session/arc_service_launcher.cc
+++ b/chrome/browser/ash/arc/session/arc_service_launcher.cc
@@ -70,7 +70,6 @@
 #include "chrome/browser/ash/arc/tracing/arc_tracing_bridge.h"
 #include "chrome/browser/ash/arc/tts/arc_tts_service.h"
 #include "chrome/browser/ash/arc/user_session/arc_user_session_service.h"
-#include "chrome/browser/ash/arc/video/gpu_arc_video_service_host.h"
 #include "chrome/browser/ash/arc/vmm/arc_system_state_bridge.h"
 #include "chrome/browser/ash/arc/vmm/arc_vmm_manager.h"
 #include "chrome/browser/ash/arc/wallpaper/arc_wallpaper_service.h"
@@ -107,6 +106,7 @@
 #include "chromeos/ash/experiences/arc/session/arc_session.h"
 #include "chromeos/ash/experiences/arc/session/arc_session_runner.h"
 #include "chromeos/ash/experiences/arc/system_ui/arc_system_ui_bridge.h"
+#include "chromeos/ash/experiences/arc/video/gpu_arc_video_service_host.h"
 #include "components/prefs/pref_member.h"
 #include "mojo/public/cpp/bindings/pending_remote.h"
 
diff --git a/chrome/browser/ash/arc/video/DEPS b/chrome/browser/ash/arc/video/DEPS
deleted file mode 100644
index 8230f449d7a62..0000000000000
--- a/chrome/browser/ash/arc/video/DEPS
+++ /dev/null
@@ -1,20 +0,0 @@
-include_rules = [
-  # ChromeOS should not depend on //chrome. See //docs/chromeos/code.md for
-  # details.
-  "-chrome",
-
-  # This directory is in //chrome, which violates the rule above. Allow this
-  # directory to #include its own files.
-  "+chrome/browser/ash/arc/video",
-
-  # Existing dependencies within //chrome. There is an active effort to
-  # refactor //chrome/browser/ash to break these dependencies; see b/332804822.
-  # Whenever possible, avoid adding new //chrome dependencies to this list.
-  #
-  # Files residing in certain directories (e.g., //chrome/browser) are listed
-  # individually. Other dependencies within //chrome are listed on a per-
-  # directory basis. See //tools/chromeos/gen_deps.sh for details.
-
-  # Dependencies outside of //chrome:
-  "+mojo/core",
-]
diff --git a/chrome/browser/ash/dbus/BUILD.gn b/chrome/browser/ash/dbus/BUILD.gn
index 8268cd8c4a788..47e34d5d1ec66 100644
--- a/chrome/browser/ash/dbus/BUILD.gn
+++ b/chrome/browser/ash/dbus/BUILD.gn
@@ -79,7 +79,6 @@ static_library("dbus") {
     "//chrome/browser/ash/arc/fileapi",
     "//chrome/browser/ash/arc/session",
     "//chrome/browser/ash/arc/tracing",
-    "//chrome/browser/ash/arc/video",
     "//chrome/browser/ash/crostini",
     "//chrome/browser/ash/login/lock",
     "//chrome/browser/ash/net",
@@ -155,6 +154,7 @@ static_library("dbus") {
     "//chromeos/ash/components/language_packs",
     "//chromeos/ash/components/settings",
     "//chromeos/ash/experiences/arc/session",
+    "//chromeos/ash/experiences/arc/video",
     "//chromeos/ash/services/rollback_network_config/public/mojom",
     "//chromeos/components/mojo_bootstrap",
     "//chromeos/dbus/constants",
diff --git a/chrome/browser/ash/dbus/DEPS b/chrome/browser/ash/dbus/DEPS
index f31047615749f..eb6d608731610 100644
--- a/chrome/browser/ash/dbus/DEPS
+++ b/chrome/browser/ash/dbus/DEPS
@@ -19,7 +19,7 @@ include_rules = [
   "+chrome/browser/ash/arc/session",
   "+chrome/browser/ash/arc/test",
   "+chrome/browser/ash/arc/tracing",
-  "+chrome/browser/ash/arc/video",
+  "+chromeos/ash/experiences/arc/video",
   "+chrome/browser/ash/borealis",
   "+chrome/browser/ash/crostini",
   "+chrome/browser/ash/exo",
diff --git a/chrome/browser/ash/dbus/libvda_service_provider.cc b/chrome/browser/ash/dbus/libvda_service_provider.cc
index aa3e58896fe11..8251ec978087c 100644
--- a/chrome/browser/ash/dbus/libvda_service_provider.cc
+++ b/chrome/browser/ash/dbus/libvda_service_provider.cc
@@ -8,7 +8,7 @@
 #include <utility>
 
 #include "base/functional/bind.h"
-#include "chrome/browser/ash/arc/video/gpu_arc_video_service_host.h"
+#include "chromeos/ash/experiences/arc/video/gpu_arc_video_service_host.h"
 #include "dbus/bus.h"
 #include "dbus/message.h"
 #include "mojo/public/cpp/system/platform_handle.h"
diff --git a/chrome/browser/ash/arc/video/BUILD.gn b/chromeos/ash/experiences/arc/video/BUILD.gn
similarity index 100%
rename from chrome/browser/ash/arc/video/BUILD.gn
rename to chromeos/ash/experiences/arc/video/BUILD.gn
diff --git a/chromeos/ash/experiences/arc/video/DEPS b/chromeos/ash/experiences/arc/video/DEPS
new file mode 100644
index 0000000000000..d6e2030b7bf81
--- /dev/null
+++ b/chromeos/ash/experiences/arc/video/DEPS
@@ -0,0 +1,3 @@
+include_rules = [
+  "+content/public/common/content_switches.h",
+]
diff --git a/chrome/browser/ash/arc/video/OWNERS b/chromeos/ash/experiences/arc/video/OWNERS
similarity index 100%
rename from chrome/browser/ash/arc/video/OWNERS
rename to chromeos/ash/experiences/arc/video/OWNERS
diff --git a/chrome/browser/ash/arc/video/gpu_arc_video_service_host.cc b/chromeos/ash/experiences/arc/video/gpu_arc_video_service_host.cc
similarity index 99%
rename from chrome/browser/ash/arc/video/gpu_arc_video_service_host.cc
rename to chromeos/ash/experiences/arc/video/gpu_arc_video_service_host.cc
index 3149de67e0d3b..711c73bdb0b9a 100644
--- a/chrome/browser/ash/arc/video/gpu_arc_video_service_host.cc
+++ b/chromeos/ash/experiences/arc/video/gpu_arc_video_service_host.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "chrome/browser/ash/arc/video/gpu_arc_video_service_host.h"
+#include "chromeos/ash/experiences/arc/video/gpu_arc_video_service_host.h"
 
 #include <memory>
 #include <string>
diff --git a/chrome/browser/ash/arc/video/gpu_arc_video_service_host.h b/chromeos/ash/experiences/arc/video/gpu_arc_video_service_host.h
similarity index 91%
rename from chrome/browser/ash/arc/video/gpu_arc_video_service_host.h
rename to chromeos/ash/experiences/arc/video/gpu_arc_video_service_host.h
index a105912be3f0a..5cb9be2d35194 100644
--- a/chrome/browser/ash/arc/video/gpu_arc_video_service_host.h
+++ b/chromeos/ash/experiences/arc/video/gpu_arc_video_service_host.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef CHROME_BROWSER_ASH_ARC_VIDEO_GPU_ARC_VIDEO_SERVICE_HOST_H_
-#define CHROME_BROWSER_ASH_ARC_VIDEO_GPU_ARC_VIDEO_SERVICE_HOST_H_
+#ifndef CHROMEOS_ASH_EXPERIENCES_ARC_VIDEO_GPU_ARC_VIDEO_SERVICE_HOST_H_
+#define CHROMEOS_ASH_EXPERIENCES_ARC_VIDEO_GPU_ARC_VIDEO_SERVICE_HOST_H_
 
 #include "ash/components/arc/mojom/video.mojom.h"
 #include "base/memory/raw_ptr.h"
@@ -70,4 +70,4 @@ class GpuArcVideoKeyedService : public KeyedService {
 
 }  // namespace arc
 
-#endif  // CHROME_BROWSER_ASH_ARC_VIDEO_GPU_ARC_VIDEO_SERVICE_HOST_H_
+#endif  // CHROMEOS_ASH_EXPERIENCES_ARC_VIDEO_GPU_ARC_VIDEO_SERVICE_HOST_H_
diff --git a/media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.cc b/media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.cc
index 170568a588fb0..1500055da2feb 100644
--- a/media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.cc
+++ b/media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.cc
@@ -24,10 +24,10 @@ using sandbox::syscall_broker::BrokerFilePermission;
 // to exist only in those configurations so that the presandbox hook is only
 // compiled in those scenarios. As it is now, kHardwareVideoDecoding exists for
 // all ash-chrome builds because
-// chrome/browser/ash/arc/video/gpu_arc_video_service_host.cc depends on it and
-// that file is built for ash-chrome regardless of VA-API/V4L2. That means that
-// bots like linux-chromeos-rel end up compiling this presandbox hook (thus the
-// NOTREACHED()s in some places here).
+// chromeos/ash/experiences/arc/video/gpu_arc_video_service_host.cc depends on
+// it and that file is built for ash-chrome regardless of VA-API/V4L2. That
+// means that bots like linux-chromeos-rel end up compiling this presandbox hook
+// (thus the NOTREACHED()s in some places here).
 
 namespace media {
 namespace {
diff --git a/media/gpu/sandbox/hardware_video_encoding_sandbox_hook_linux.cc b/media/gpu/sandbox/hardware_video_encoding_sandbox_hook_linux.cc
index 2154e19bfff70..97269b9fd2b1a 100644
--- a/media/gpu/sandbox/hardware_video_encoding_sandbox_hook_linux.cc
+++ b/media/gpu/sandbox/hardware_video_encoding_sandbox_hook_linux.cc
@@ -107,10 +107,10 @@ bool HardwareVideoEncodingPreSandboxHook(
   // sandbox type to exist only in those configurations so that the presandbox
   // hook is only reached in those scenarios. As it is now,
   // kHardwareVideoEncoding exists for all ash-chrome builds because
-  // chrome/browser/ash/arc/video/gpu_arc_video_service_host.cc is expected to
-  // depend on it eventually and that file is built for ash-chrome regardless
-  // of VA-API/V4L2. That means that bots like linux-chromeos-rel would end up
-  // reaching this presandbox hook.
+  // chromeos/ash/experiences/arc/video/gpu_arc_video_service_host.cc is
+  // expected to depend on it eventually and that file is built for ash-chrome
+  // regardless of VA-API/V4L2. That means that bots like linux-chromeos-rel
+  // would end up reaching this presandbox hook.
 #if BUILDFLAG(USE_VAAPI)
   VaapiWrapper::PreSandboxInitialization(/*allow_disabling_global_lock=*/true);
 
diff --git a/sandbox/policy/linux/bpf_hardware_video_decoding_policy_linux.cc b/sandbox/policy/linux/bpf_hardware_video_decoding_policy_linux.cc
index 8eab298118ee5..e15be339bc08d 100644
--- a/sandbox/policy/linux/bpf_hardware_video_decoding_policy_linux.cc
+++ b/sandbox/policy/linux/bpf_hardware_video_decoding_policy_linux.cc
@@ -44,9 +44,9 @@ HardwareVideoDecodingProcessPolicy::ComputePolicyType(
   // sandbox type to exist only in those configurations so that the
   // HardwareVideoDecodingProcessPolicy is only compiled in those scenarios. As
   // it is now, kHardwareVideoDecoding exists for all ash-chrome builds because
-  // chrome/browser/ash/arc/video/gpu_arc_video_service_host.cc depends on it
-  // and that file is built for ash-chrome regardless of VA-API/V4L2. That means
-  // that bots like linux-chromeos-rel end up compiling this policy.
+  // chromeos/ash/experiences/arc/video/gpu_arc_video_service_host.cc depends on
+  // it and that file is built for ash-chrome regardless of VA-API/V4L2. That
+  // means that bots like linux-chromeos-rel end up compiling this policy.
   NOTREACHED();
 #endif
 }