Browse Source

build: remove enable_picture_in_picture build flag (#38620)

Co-authored-by: Milan Burda <[email protected]>
Milan Burda 1 year ago
parent
commit
0294debc31

+ 0 - 1
buildflags/BUILD.gn

@@ -15,7 +15,6 @@ buildflag_header("buildflags") {
     "ENABLE_PDF_VIEWER=$enable_pdf_viewer",
     "ENABLE_ELECTRON_EXTENSIONS=$enable_electron_extensions",
     "ENABLE_BUILTIN_SPELLCHECKER=$enable_builtin_spellchecker",
-    "ENABLE_PICTURE_IN_PICTURE=$enable_picture_in_picture",
     "OVERRIDE_LOCATION_PROVIDER=$enable_fake_location_provider",
   ]
 }

+ 0 - 2
buildflags/buildflags.gni

@@ -12,8 +12,6 @@ declare_args() {
 
   enable_pdf_viewer = true
 
-  enable_picture_in_picture = true
-
   # Provide a fake location provider for mocking
   # the geolocation responses. Disable it if you
   # need to test with chromium's location provider.

+ 27 - 35
chromium_src/BUILD.gn

@@ -51,6 +51,8 @@ static_library("chrome") {
     "//chrome/browser/net/proxy_config_monitor.h",
     "//chrome/browser/net/proxy_service_factory.cc",
     "//chrome/browser/net/proxy_service_factory.h",
+    "//chrome/browser/picture_in_picture/picture_in_picture_window_manager.cc",
+    "//chrome/browser/picture_in_picture/picture_in_picture_window_manager.h",
     "//chrome/browser/platform_util.cc",
     "//chrome/browser/platform_util.h",
     "//chrome/browser/predictors/preconnect_manager.cc",
@@ -94,6 +96,28 @@ static_library("chrome") {
     "//chrome/browser/ui/views/eye_dropper/eye_dropper.h",
     "//chrome/browser/ui/views/eye_dropper/eye_dropper_view.cc",
     "//chrome/browser/ui/views/eye_dropper/eye_dropper_view.h",
+    "//chrome/browser/ui/views/overlay/back_to_tab_label_button.cc",
+    "//chrome/browser/ui/views/overlay/close_image_button.cc",
+    "//chrome/browser/ui/views/overlay/close_image_button.h",
+    "//chrome/browser/ui/views/overlay/constants.h",
+    "//chrome/browser/ui/views/overlay/hang_up_button.cc",
+    "//chrome/browser/ui/views/overlay/hang_up_button.h",
+    "//chrome/browser/ui/views/overlay/overlay_window_image_button.cc",
+    "//chrome/browser/ui/views/overlay/overlay_window_image_button.h",
+    "//chrome/browser/ui/views/overlay/playback_image_button.cc",
+    "//chrome/browser/ui/views/overlay/playback_image_button.h",
+    "//chrome/browser/ui/views/overlay/resize_handle_button.cc",
+    "//chrome/browser/ui/views/overlay/resize_handle_button.h",
+    "//chrome/browser/ui/views/overlay/simple_overlay_window_image_button.cc",
+    "//chrome/browser/ui/views/overlay/simple_overlay_window_image_button.h",
+    "//chrome/browser/ui/views/overlay/skip_ad_label_button.cc",
+    "//chrome/browser/ui/views/overlay/skip_ad_label_button.h",
+    "//chrome/browser/ui/views/overlay/toggle_camera_button.cc",
+    "//chrome/browser/ui/views/overlay/toggle_camera_button.h",
+    "//chrome/browser/ui/views/overlay/toggle_microphone_button.cc",
+    "//chrome/browser/ui/views/overlay/toggle_microphone_button.h",
+    "//chrome/browser/ui/views/overlay/video_overlay_window_views.cc",
+    "//chrome/browser/ui/views/overlay/video_overlay_window_views.h",
     "//extensions/browser/app_window/size_constraints.cc",
     "//extensions/browser/app_window/size_constraints.h",
     "//ui/views/native_window_tracker.h",
@@ -166,9 +190,12 @@ static_library("chrome") {
   ]
 
   deps = [
+    "//chrome/app/vector_icons",
     "//chrome/browser:resource_prefetch_predictor_proto",
     "//chrome/browser/resource_coordinator:mojo_bindings",
+    "//components/vector_icons:vector_icons",
     "//ui/snapshot",
+    "//ui/views/controls/webview",
   ]
 
   if (is_linux) {
@@ -271,41 +298,6 @@ static_library("chrome") {
     }
   }
 
-  if (enable_picture_in_picture) {
-    sources += [
-      "//chrome/browser/picture_in_picture/picture_in_picture_window_manager.cc",
-      "//chrome/browser/picture_in_picture/picture_in_picture_window_manager.h",
-      "//chrome/browser/ui/views/overlay/back_to_tab_label_button.cc",
-      "//chrome/browser/ui/views/overlay/close_image_button.cc",
-      "//chrome/browser/ui/views/overlay/close_image_button.h",
-      "//chrome/browser/ui/views/overlay/constants.h",
-      "//chrome/browser/ui/views/overlay/hang_up_button.cc",
-      "//chrome/browser/ui/views/overlay/hang_up_button.h",
-      "//chrome/browser/ui/views/overlay/overlay_window_image_button.cc",
-      "//chrome/browser/ui/views/overlay/overlay_window_image_button.h",
-      "//chrome/browser/ui/views/overlay/playback_image_button.cc",
-      "//chrome/browser/ui/views/overlay/playback_image_button.h",
-      "//chrome/browser/ui/views/overlay/resize_handle_button.cc",
-      "//chrome/browser/ui/views/overlay/resize_handle_button.h",
-      "//chrome/browser/ui/views/overlay/simple_overlay_window_image_button.cc",
-      "//chrome/browser/ui/views/overlay/simple_overlay_window_image_button.h",
-      "//chrome/browser/ui/views/overlay/skip_ad_label_button.cc",
-      "//chrome/browser/ui/views/overlay/skip_ad_label_button.h",
-      "//chrome/browser/ui/views/overlay/toggle_camera_button.cc",
-      "//chrome/browser/ui/views/overlay/toggle_camera_button.h",
-      "//chrome/browser/ui/views/overlay/toggle_microphone_button.cc",
-      "//chrome/browser/ui/views/overlay/toggle_microphone_button.h",
-      "//chrome/browser/ui/views/overlay/video_overlay_window_views.cc",
-      "//chrome/browser/ui/views/overlay/video_overlay_window_views.h",
-    ]
-
-    deps += [
-      "//chrome/app/vector_icons",
-      "//components/vector_icons:vector_icons",
-      "//ui/views/controls/webview",
-    ]
-  }
-
   if (enable_electron_extensions) {
     sources += [
       "//chrome/browser/extensions/chrome_url_request_util.cc",

+ 1 - 10
shell/browser/api/electron_api_web_contents.cc

@@ -23,6 +23,7 @@
 #include "base/threading/scoped_blocking_call.h"
 #include "base/values.h"
 #include "chrome/browser/browser_process.h"
+#include "chrome/browser/picture_in_picture/picture_in_picture_window_manager.h"
 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
 #include "chrome/browser/ui/views/eye_dropper/eye_dropper.h"
 #include "chrome/common/pref_names.h"
@@ -184,10 +185,6 @@
 #endif
 #endif  // BUILDFLAG(ENABLE_PRINTING)
 
-#if BUILDFLAG(ENABLE_PICTURE_IN_PICTURE)
-#include "chrome/browser/picture_in_picture/picture_in_picture_window_manager.h"
-#endif
-
 #if BUILDFLAG(ENABLE_PDF_VIEWER)
 #include "components/pdf/browser/pdf_web_contents_helper.h"  // nogncheck
 #include "shell/browser/electron_pdf_web_contents_helper_client.h"
@@ -3896,18 +3893,12 @@ bool WebContents::TakeFocus(content::WebContents* source, bool reverse) {
 
 content::PictureInPictureResult WebContents::EnterPictureInPicture(
     content::WebContents* web_contents) {
-#if BUILDFLAG(ENABLE_PICTURE_IN_PICTURE)
   return PictureInPictureWindowManager::GetInstance()
       ->EnterVideoPictureInPicture(web_contents);
-#else
-  return content::PictureInPictureResult::kNotSupported;
-#endif
 }
 
 void WebContents::ExitPictureInPicture() {
-#if BUILDFLAG(ENABLE_PICTURE_IN_PICTURE)
   PictureInPictureWindowManager::GetInstance()->ExitPictureInPicture();
-#endif
 }
 
 void WebContents::DevToolsSaveToFile(const std::string& url,

+ 1 - 6
shell/browser/electron_browser_client.cc

@@ -186,7 +186,7 @@
 #include "components/crash/core/app/crashpad.h"        // nogncheck
 #endif
 
-#if BUILDFLAG(ENABLE_PICTURE_IN_PICTURE) && BUILDFLAG(IS_WIN)
+#if BUILDFLAG(IS_WIN)
 #include "chrome/browser/ui/views/overlay/video_overlay_window_views.h"
 #include "shell/browser/browser.h"
 #include "ui/aura/window.h"
@@ -422,9 +422,6 @@ void ElectronBrowserClient::OverrideWebkitPrefs(
   prefs->default_minimum_page_scale_factor = 1.f;
   prefs->default_maximum_page_scale_factor = 1.f;
   prefs->navigate_on_drag_drop = false;
-#if !BUILDFLAG(ENABLE_PICTURE_IN_PICTURE)
-  prefs->picture_in_picture_enabled = false;
-#endif
 
   ui::NativeTheme* native_theme = ui::NativeTheme::GetInstanceForNativeUi();
   prefs->preferred_color_scheme =
@@ -674,7 +671,6 @@ bool ElectronBrowserClient::CanCreateWindow(
   return false;
 }
 
-#if BUILDFLAG(ENABLE_PICTURE_IN_PICTURE)
 std::unique_ptr<content::VideoOverlayWindow>
 ElectronBrowserClient::CreateWindowForVideoPictureInPicture(
     content::VideoPictureInPictureWindowController* controller) {
@@ -692,7 +688,6 @@ ElectronBrowserClient::CreateWindowForVideoPictureInPicture(
 #endif
   return overlay_window;
 }
-#endif
 
 void ElectronBrowserClient::GetAdditionalAllowedSchemesForFileSystem(
     std::vector<std::string>* additional_schemes) {

+ 0 - 2
shell/browser/electron_browser_client.h

@@ -160,11 +160,9 @@ class ElectronBrowserClient : public content::ContentBrowserClient,
                        bool user_gesture,
                        bool opener_suppressed,
                        bool* no_javascript_access) override;
-#if BUILDFLAG(ENABLE_PICTURE_IN_PICTURE)
   std::unique_ptr<content::VideoOverlayWindow>
   CreateWindowForVideoPictureInPicture(
       content::VideoPictureInPictureWindowController* controller) override;
-#endif
   void GetAdditionalAllowedSchemesForFileSystem(
       std::vector<std::string>* additional_schemes) override;
   void GetAdditionalWebUISchemes(

+ 0 - 4
shell/browser/feature_list.cc

@@ -36,10 +36,6 @@ void InitializeFeatureList() {
   disable_features +=
       std::string(",") + features::kSpareRendererForSitePerProcess.name;
 
-#if !BUILDFLAG(ENABLE_PICTURE_IN_PICTURE)
-  disable_features += std::string(",") + media::kPictureInPicture.name;
-#endif
-
 #if BUILDFLAG(IS_WIN)
   disable_features +=
       // Disable async spellchecker suggestions for Windows, which causes

+ 0 - 5
shell/common/api/features.cc

@@ -42,10 +42,6 @@ bool IsExtensionsEnabled() {
   return BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS);
 }
 
-bool IsPictureInPictureEnabled() {
-  return BUILDFLAG(ENABLE_PICTURE_IN_PICTURE);
-}
-
 bool IsComponentBuild() {
 #if defined(COMPONENT_BUILD)
   return true;
@@ -67,7 +63,6 @@ void Initialize(v8::Local<v8::Object> exports,
                  &IsFakeLocationProviderEnabled);
   dict.SetMethod("isViewApiEnabled", &IsViewApiEnabled);
   dict.SetMethod("isPrintingEnabled", &IsPrintingEnabled);
-  dict.SetMethod("isPictureInPictureEnabled", &IsPictureInPictureEnabled);
   dict.SetMethod("isComponentBuild", &IsComponentBuild);
   dict.SetMethod("isExtensionsEnabled", &IsExtensionsEnabled);
 }

+ 1 - 2
spec/api-web-contents-spec.ts

@@ -2065,8 +2065,7 @@ describe('webContents module', () => {
 
       await w.webContents.executeJavaScript('document.createElement(\'video\').canPlayType(\'video/webm; codecs="vp8.0"\')', true);
 
-      const result = await w.webContents.executeJavaScript(
-        `runTest(${features.isPictureInPictureEnabled()})`, true);
+      const result = await w.webContents.executeJavaScript('runTest(true)', true);
       expect(result).to.be.true();
     });
   });

+ 0 - 1
typings/internal-ambient.d.ts

@@ -11,7 +11,6 @@ declare namespace NodeJS {
     isFakeLocationProviderEnabled(): boolean;
     isViewApiEnabled(): boolean;
     isPrintingEnabled(): boolean;
-    isPictureInPictureEnabled(): boolean;
     isExtensionsEnabled(): boolean;
     isComponentBuild(): boolean;
   }