Files
electron/patches/chromium/picture-in-picture.patch
electron-roller[bot] fe477ce3aa chore: bump chromium to 145.0.7568.0 (main) (#49145)
* chore: bump chromium in DEPS to 145.0.7562.0

* fix(patch-conflict): update code cache patch for PersistentCache refactor

Upstream refactored code cache to use PersistentCache with new class-based
implementation (NoopCodeCacheHost, LocalCodeCacheHost, CodeCacheWithPersistentCacheHost).
Updated patch to integrate custom scheme support into the new structure while
preserving ProcessLockURLIsCodeCacheScheme checks for embedder-registered schemes.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7044986

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>

* fix(patch-conflict): update dialog patch for RequestXdgDesktopPortal API

Upstream changed from SetSystemdScopeUnitNameForXdgPortal to RequestXdgDesktopPortal
API pattern. Updated OnServiceStarted signature and kept OnSystemdUnitStarted callback
that calls Electron's file_dialog::StartPortalAvailabilityTestInBackground().

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7204285

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>

* fix(patch-conflict): remove reference to deleted AbortByPlaceholderLayout flag

Upstream removed the AbortByPlaceholderLayout runtime flag from
runtime_enabled_features.json5. Updated patch to only add ElectronCSSCornerSmoothing
without the removed flag reference.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7226494

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>

* chore: update patch hunk headers

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>

* fix(build): guard media_file_system_registry for ChromeOS only

Upstream CL https://chromium-review.googlesource.com/c/chromium/src/+/7100719
moved media_file_system_registry to be ChromeOS-only since Media
Galleries is a Chrome Apps API and Chrome Apps are only available
on Chrome OS now.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>

* fix(build): update VideoPixelFormat API for SharedImageFormat

Upstream CL https://chromium-review.googlesource.com/c/chromium/src/+/7207153
removed VideoPixelFormatToGfxBufferFormat as part of migration to
SharedImageFormat. Update to use VideoPixelFormatToSharedImageFormat
which directly returns the SharedImageFormat.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>

* fix(build): extend profile methods patch for ShouldEnableXfaForms

The ShouldEnableXfaForms function uses Profile::FromBrowserContext()
which is not available in Electron. Wrap the profile-dependent code
in #if 0 to fall through to the feature flag default.

Co-Authored-By: Claude <noreply@anthropic.com>

* chore: bump chromium in DEPS to 145.0.7563.0

* chore: bump chromium in DEPS to 145.0.7565.0

* chore: bump chromium in DEPS to 145.0.7567.0

* chore: bump chromium in DEPS to 145.0.7568.0

* fix(patch-conflict): update content_main_delegate.h context for IsInitFeatureListEarly

Upstream added a new IsInitFeatureListEarly() virtual method to ContentMainDelegate
just before where our GetBrowserV8SnapshotFilename() method is added. Updated patch
context to account for this new method.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7092856

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>

* chore: update patch hunk headers

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>

* fix(patch-update): include v8-cppgc.h for CppHeap complete type

The std::unique_ptr<v8::CppHeap> default argument in node.h requires
the complete CppHeap type definition for the destructor. Added the
v8-cppgc.h include to provide the full type definition.

Ref: Unable to locate CL - libc++ unique_ptr requires complete type for destructor

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>

* chore: update patch hunk headers

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>

* fix(build): move NativeAppWindowFrameViewMacClient before constructor

The std::unique_ptr<NativeAppWindowFrameViewMacClient> member requires
the complete type definition to be visible at the point of the constructor
because the unique_ptr destructor may be instantiated during exception
handling. Moved the class definition before the NativeWindowMac constructor.

Ref: Unable to locate CL - libc++ unique_ptr requires complete type for destructor

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>

* fix(patch-conflict): update create_browser_v8_snapshot_file_name_fuse context for IsInitFeatureListEarly

The upstream added IsInitFeatureListEarly() virtual method declaration to
ContentMainDelegate class. Updated the patch context to account for this
new function being present before the GetBrowserV8SnapshotFilename()
declaration we add.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7092856

Co-Authored-By: Claude <noreply@anthropic.com>

* chore: update patch hunk headers

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(patch-update): remove reverted IsInitFeatureListEarly from v8 snapshot patch

The upstream added IsInitFeatureListEarly() was reverted, so the patch should
not include this declaration. Only GetBrowserV8SnapshotFilename() should be
added by the create_browser_v8_snapshot_file_name_fuse patch.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7230430

Co-Authored-By: Claude <noreply@anthropic.com>

* 6171655: include single_thread_task_runner.h for complete type

Added include for base/task/single_thread_task_runner.h in osr_converter.cc
to resolve incomplete type error when using
base::SingleThreadTaskRunner::GetCurrentDefault().

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/6171655

Co-Authored-By: Claude <noreply@anthropic.com>

* 7224136: use CHROMIUM_GIT_REVISION directly instead of removed function

Upstream removed GetChromiumGitRevision() function from embedder_support.
Updated to use CHROMIUM_GIT_REVISION macro directly via
build/util/chromium_git_revision.h as recommended in the Chromium CL.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7224136

Co-Authored-By: Claude <noreply@anthropic.com>

* fixup! 7224136: use CHROMIUM_GIT_REVISION directly instead of removed function

* fix(build): add missing include

`components/dbus/xdg/systemd.h` for `void OnSystemdUnitStarted(dbus_xdg::SystemdUnitStatus)` in the same patch.

* fix(build): adapt to string-view-ification change in windows jump_list.cc

7186922: Fix unsafe buffer usage in base/win/win_util.cc
https://chromium-review.googlesource.com/c/chromium/src/+/7186922

* chore: update libc++ filenames

* fixup! fix(build): add missing include

* fixup! fix(build): extend profile methods patch for ShouldEnableXfaForms

* fixup! fix(build): guard media_file_system_registry for ChromeOS only

* fixup! fixup! fix(build): extend profile methods patch for ShouldEnableXfaForms

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
Co-authored-by: Claude <svc-devxp-claude@slack-corp.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: clavin <clavin@electronjs.org>
2025-12-10 10:28:31 -05:00

236 lines
9.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Heilig Benedek <benecene@gmail.com>
Date: Sat, 10 Aug 2019 00:41:50 +0200
Subject: feat: enable picture in picture mode for video players
These files are needed to implement PiP, but the Electron build patches out
chrome's generated resources for our own. This updates the #include so that we
don't get errors for Chrome's generated resources, which are non-existent
because we don't generate them in our build.
diff --git a/chrome/browser/ui/views/overlay/close_image_button.cc b/chrome/browser/ui/views/overlay/close_image_button.cc
index a7a637438116a1c7846194dea4412100a45c9331..bb3877d546bfea141d3d6ebb396b88faab6ee34e 100644
--- a/chrome/browser/ui/views/overlay/close_image_button.cc
+++ b/chrome/browser/ui/views/overlay/close_image_button.cc
@@ -4,9 +4,12 @@
#include "chrome/browser/ui/views/overlay/close_image_button.h"
+#include "build/branding_buildflags.h"
#include "chrome/browser/ui/color/chrome_color_id.h"
#include "chrome/grit/generated_resources.h"
+#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
#include "components/vector_icons/vector_icons.h"
+#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/models/image_model.h"
@@ -27,7 +30,10 @@ CloseImageButton::CloseImageButton(PressedCallback callback)
: OverlayWindowImageButton(std::move(callback)) {
SetSize(gfx::Size(kCloseButtonSize, kCloseButtonSize));
- auto* icon = &vector_icons::kCloseChromeRefreshIcon;
+ auto* icon = &views::kIcCloseIcon;
+#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
+ icon = &vector_icons::kCloseChromeRefreshIcon;
+#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
SetImageModel(views::Button::STATE_NORMAL,
ui::ImageModel::FromVectorIcon(*icon, kColorPipWindowForeground,
kCloseButtonIconSize));
diff --git a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc
index 7202d7f18e92fbc0cd759a1e4f84a26c0706dcc3..055b0d6a9a4dea735ed31365831690ae85d1c2ee 100644
--- a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc
+++ b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc
@@ -18,12 +18,16 @@
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "build/build_config.h"
+#if 0
#include "chrome/browser/media/media_engagement_service.h"
+#endif
#include "chrome/browser/picture_in_picture/picture_in_picture_occlusion_tracker.h"
#include "chrome/browser/picture_in_picture/picture_in_picture_window_manager.h"
+#if 0
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
+#endif
#include "chrome/browser/ui/color/chrome_color_id.h"
#include "chrome/browser/ui/views/overlay/back_to_tab_button.h"
#include "chrome/browser/ui/views/overlay/back_to_tab_label_button.h"
@@ -32,8 +36,10 @@
#include "chrome/browser/ui/views/overlay/hang_up_button.h"
#include "chrome/browser/ui/views/overlay/minimize_button.h"
#include "chrome/browser/ui/views/overlay/overlay_controls_fade_animation.h"
+#if 0
#include "chrome/browser/ui/views/overlay/overlay_window_live_caption_button.h"
#include "chrome/browser/ui/views/overlay/overlay_window_live_caption_dialog.h"
+#endif
#include "chrome/browser/ui/views/overlay/playback_image_button.h"
#include "chrome/browser/ui/views/overlay/resize_handle_button.h"
#include "chrome/browser/ui/views/overlay/simple_overlay_window_image_button.h"
@@ -79,7 +85,7 @@
#include "ui/aura/window.h"
#endif
-#if BUILDFLAG(IS_WIN)
+#if 0
#include "chrome/browser/shell_integration_win.h"
#include "content/public/browser/render_widget_host_view.h"
#include "ui/aura/window.h"
@@ -401,7 +407,7 @@ std::unique_ptr<VideoOverlayWindowViews> VideoOverlayWindowViews::Create(
overlay_window->Init(std::move(params));
overlay_window->OnRootViewReady();
-#if BUILDFLAG(IS_WIN)
+#if 0
std::wstring app_user_model_id;
Browser* browser = chrome::FindBrowserWithTab(controller->GetWebContents());
if (browser) {
@@ -694,6 +700,7 @@ void VideoOverlayWindowViews::OnMouseEvent(ui::MouseEvent* event) {
}
case ui::EventType::kMousePressed:
+#if 0
// Hide the live caption dialog if it's visible and the user clicks
// outside of it.
if (live_caption_dialog_ && live_caption_dialog_->GetVisible() &&
@@ -702,6 +709,7 @@ void VideoOverlayWindowViews::OnMouseEvent(ui::MouseEvent* event) {
SetLiveCaptionDialogVisibility(false);
return;
}
+#endif
break;
default:
@@ -737,11 +745,11 @@ bool VideoOverlayWindowViews::HideLiveCaptionDialogForGestureIfNecessary(
if (event->type() != ui::EventType::kGestureTap) {
return false;
}
-
+#if 0
if (!live_caption_dialog_->GetVisible()) {
return false;
}
-
+#endif
if (!GetLiveCaptionDialogBounds().Contains(event->location())) {
SetLiveCaptionDialogVisibility(false);
event->SetHandled();
@@ -1219,6 +1227,7 @@ void VideoOverlayWindowViews::SetUpViews() {
timestamp->SetBackgroundColor(SK_ColorTRANSPARENT);
timestamp->SetHorizontalAlignment(gfx::ALIGN_LEFT);
+#if 0
auto live_status = std::make_unique<views::Label>(
l10n_util::GetStringUTF16(IDS_PICTURE_IN_PICTURE_LIVE_STATUS_TEXT),
views::style::CONTEXT_LABEL, views::style::STYLE_CAPTION_BOLD);
@@ -1238,6 +1247,7 @@ void VideoOverlayWindowViews::SetUpViews() {
Profile::FromBrowserContext(
controller_->GetWebContents()->GetBrowserContext()));
live_caption_dialog->SetVisible(false);
+#endif
auto toggle_microphone_button =
std::make_unique<ToggleMicrophoneButton>(base::BindRepeating(
@@ -1360,13 +1370,15 @@ void VideoOverlayWindowViews::SetUpViews() {
timestamp_ =
playback_controls_container_view_->AddChildView(std::move(timestamp));
+
+#if 0
live_status_ =
playback_controls_container_view_->AddChildView(std::move(live_status));
-
live_caption_button_ = playback_controls_container_view_->AddChildView(
std::move(live_caption_button));
live_caption_dialog_ =
controls_container_view_->AddChildView(std::move(live_caption_dialog));
+#endif
toggle_camera_button_ = vc_controls_container_view_->AddChildView(
std::move(toggle_camera_button));
@@ -1645,6 +1657,7 @@ void VideoOverlayWindowViews::OnUpdateControlsBounds() {
timestamp_->SetSize({max_timestamp_width, kTimestampHeight});
timestamp_->SetVisible(!is_live_);
+#if 0
live_status_->SetPosition(timestamp_position);
live_status_->SetMaximumWidthSingleLine(max_timestamp_width);
live_status_->SetSize(
@@ -1652,7 +1665,6 @@ void VideoOverlayWindowViews::OnUpdateControlsBounds() {
.width(),
kTimestampHeight});
live_status_->SetVisible(is_live_);
-
gfx::Rect live_caption_button_bounds(
bottom_controls_bounds.right() - kBottomControlsHorizontalMargin -
kActionButtonSize.width(),
@@ -1665,7 +1677,7 @@ void VideoOverlayWindowViews::OnUpdateControlsBounds() {
live_caption_dialog_->SetPosition(
{live_caption_button_bounds.right() - live_caption_dialog_->width(),
live_caption_button_bounds.y() - live_caption_dialog_->height()});
-
+#endif
// The play/pause button and replay/forward 10 seconds buttons should not be
// visible while dragging the progress bar or for live media.
const bool is_dragging_progress_bar =
@@ -2064,18 +2076,25 @@ gfx::Rect VideoOverlayWindowViews::GetProgressViewBounds() {
}
gfx::Rect VideoOverlayWindowViews::GetLiveCaptionButtonBounds() {
+#if 0
return live_caption_button_->GetMirroredBounds();
+#endif
+ return gfx::Rect();
}
gfx::Rect VideoOverlayWindowViews::GetLiveCaptionDialogBounds() {
+#if 0
if (!live_caption_dialog_->GetVisible()) {
return gfx::Rect();
}
return live_caption_dialog_->GetMirroredBounds();
+#endif
+ return gfx::Rect();
}
bool VideoOverlayWindowViews::HasHighMediaEngagement(
const url::Origin& origin) const {
+#if 0
MediaEngagementService* service =
MediaEngagementService::Get(Profile::FromBrowserContext(
GetController()->GetWebContents()->GetBrowserContext()));
@@ -2084,6 +2103,8 @@ bool VideoOverlayWindowViews::HasHighMediaEngagement(
}
return service->HasHighEngagement(origin);
+#endif
+ return true;
}
bool VideoOverlayWindowViews::IsTrustedForMediaPlayback() const {
@@ -2340,11 +2361,14 @@ void VideoOverlayWindowViews::UpdateTimestampLabel(base::TimeDelta current_time,
}
void VideoOverlayWindowViews::OnLiveCaptionButtonPressed() {
+#if 0
SetLiveCaptionDialogVisibility(!live_caption_dialog_->GetVisible());
+#endif
}
void VideoOverlayWindowViews::SetLiveCaptionDialogVisibility(
bool wanted_visibility) {
+#if 0
if (wanted_visibility == live_caption_dialog_->GetVisible()) {
return;
}
@@ -2367,6 +2391,7 @@ void VideoOverlayWindowViews::SetLiveCaptionDialogVisibility(
for (auto* control : controls_to_be_disabled_when_live_caption_is_open) {
control->SetEnabled(!wanted_visibility);
}
+#endif
}
void VideoOverlayWindowViews::OnFaviconReceived(const SkBitmap& image) {