Files
electron/patches/chromium/picture-in-picture.patch
electron-roller[bot] 809ab09b6f chore: bump chromium to 145.0.7596.0 (main) (#49224)
* chore: bump chromium in DEPS to 145.0.7588.0

* fix(patch-conflict): update scroll_bounce_flag for split overscroll methods

Chromium split IsElasticOverscrollEnabled() into two methods:
IsElasticOverscrollEnabledOnRoot() and IsElasticOverscrollSupported().
Updated patch to apply the scroll-bounce command-line switch to both
methods.

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

* fix(patch-conflict): update exclusive_access patch context

Upstream refactored the profile variable declaration. Updated patch to
match new surrounding context with brace-style if statement.

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

* fix(patch-conflict): update screen capture kit non-shareable filter

Upstream refactored PiP window exclusion to use GetWindowsToExclude()
helper function. Updated patch to combine non-shareable window filtering
with the new helper's output.

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

* fix(patch-conflict): update corner smoothing CSS property id position

Upstream added new internal overscroll CSS properties. Updated patch to
add kElectronCornerSmoothing after the new entries.

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

* fix(patch-conflict): update permission patches for new permission types

Upstream added new permission types: LOCAL_NETWORK, LOOPBACK_NETWORK,
and GEOLOCATION_APPROXIMATE. Updated Electron permission patches to
include these new types and renumber Electron-specific permissions.

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

* fix(patch-conflict): update memory query fallback for new function signature

Upstream added AmountOfTotalPhysicalMemory() with PCHECK. Updated patch
to maintain fallback logic with correct ByteSize return type.

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

* chore: update patch hunk headers

* fix(patch): update reclient-configs patch to use new file mode

The fix_add_python_remote_wrapper patch was using 'copy from' mode
which caused inconsistent behavior between local and CI git versions.
Changed to 'new file' mode for consistent patch application.

* fix(patch-conflict): remove duplicate GEOLOCATION_APPROXIMATE case

Upstream moved GEOLOCATION_APPROXIMATE earlier in the switch statement
in GetPermissionString(). The 3-way merge kept both the old and new
positions, causing a duplicate case error.

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

* chore: update libcxx filenames for new headers

* chore: bump chromium in DEPS to 145.0.7590.0

* chore: update patch hunk headers

* fix(patch): update memory fallback return type to ByteSize

Upstream changed the return type from ByteCount to ByteSize.

* fix: suppress nodiscard warning in node_file.cc

libc++ added [[nodiscard]] to std::filesystem::copy_options operator|=
which causes build failures with -Werror.

* 7229082: update CopyFromSurface to use CopyFromSurfaceResult

Upstream changed CopyFromSurface callback to return
base::expected<viz::CopyOutputBitmapWithMetadata, std::string>
instead of SkBitmap, enabling better error handling.

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

* 7254070: add ip_address_space param to OnLocalNetworkAccessPermissionRequired

Upstream added IPAddressSpace parameter to check address space for
proper permission handling in Local Network Access.

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

* 7136679: add spelling_markers param to RequestCheckingOfText

Upstream added spelling_markers parameter to report misspelling
ranges from Blink to Spellcheck to IME.

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

* 7240487: remove second param from RegisterWebSafeIsolatedScheme

Upstream removed the schemes_okay_to_appear_as_origin_headers_ parameter.

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

* 7254577: use explicit WebElement constructor

WebElement default constructor now requires explicit construction
rather than brace initialization.

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

* 7256335: remove override from CreateGlobalFeaturesForTesting

Upstream removed BrowserProcess::CreateGlobalFeaturesForTesting virtual
method so the override specifier is no longer valid.

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

* chore: add missing SingleThreadTaskRunner include

A transitive include of SingleThreadTaskRunner was removed upstream,
requiring an explicit include.

Ref: Unable to locate specific CL (transitive include change)

* 7260483: add LOCAL_NETWORK, LOOPBACK_NETWORK permission type cases

Upstream added new permission types for Local Network Access split
permissions.

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

* chore: update patch hunk headers

* 7264893: update postMessage tests for file: origin serialization change

Chromium now serializes file: origins as 'null' in MessageEvent per spec.
This is a security improvement aligning with the HTML spec behavior.

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

* fix: add paths to custom scheme URLs in protocol tests

Custom scheme URLs without paths (e.g. test-scheme://foo) cause a
DCHECK crash in ASAN builds when CorsURLLoader tries to log the
request via GenerateRequestLine -> PathForRequest, which asserts
that the path is non-empty.

Adding trailing slashes ensures URLs have valid paths.

* chore: bump chromium in DEPS to 145.0.7592.0

* chore: update patches (trivial only)

* chore: bump chromium in DEPS to 145.0.7594.0

* chore: bump chromium in DEPS to 145.0.7596.0

* chore: update accelerator.patch

no manual changes; patch applied with fuzz 2 (offset 1 line)

* chore: update patches (trivial only)

* chore: node ./script/gen-libc++-filenames.js

---------

Co-authored-by: Alice Zhao <alicelovescake@anthropic.com>
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-12-25 17:15:53 -06: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 8ccc5385ede42f3dd771c9fe143cf630ae0709f1..2e4bf0a29d47a27a2bd0feadd72faff21c697a40 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();
@@ -1221,6 +1229,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);
@@ -1240,6 +1249,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(
@@ -1362,13 +1372,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));
@@ -1647,6 +1659,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(
@@ -1654,7 +1667,6 @@ void VideoOverlayWindowViews::OnUpdateControlsBounds() {
.width(),
kTimestampHeight});
live_status_->SetVisible(is_live_);
-
gfx::Rect live_caption_button_bounds(
bottom_controls_bounds.right() - kBottomControlsHorizontalMargin -
kActionButtonSize.width(),
@@ -1667,7 +1679,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 =
@@ -2066,18 +2078,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()));
@@ -2086,6 +2105,8 @@ bool VideoOverlayWindowViews::HasHighMediaEngagement(
}
return service->HasHighEngagement(origin);
+#endif
+ return true;
}
bool VideoOverlayWindowViews::IsTrustedForMediaPlayback() const {
@@ -2347,11 +2368,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;
}
@@ -2374,6 +2398,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) {