fix(patch-conflict): update picture-in-picture for gesture handling refactor

Upstream Chromium commit 39d5d94e61bac refactored gesture handling in
video picture-in-picture. The HideLiveCaptionDialogForGestureIfNecessary
function body now accesses live_caption_dialog_->GetVisible() which
requires the full type definition. Since Electron disables live caption
functionality by not including overlay_window_live_caption_dialog.h,
this causes a build error.

This fix wraps the function body in #if 0 and returns false, consistent
with how other live caption code is disabled in this patch.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Samuel Attard
2025-11-21 10:27:05 -08:00
parent ccc8780011
commit d45ea124f6

View File

@@ -38,7 +38,7 @@ index a7a637438116a1c7846194dea4412100a45c9331..bb3877d546bfea141d3d6ebb396b88fa
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 1d7d033888bf8b9ff3ea1e938dc9d92fd09f2bfe..175b9704fb756747f865011a225767ae7aab7cf9 100644
index 1d7d033888bf8b9ff3ea1e938dc9d92fd09f2bfe..1a8d3e9a2277d56355c912db3b4c3372c8edc8d3 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 @@
@@ -103,7 +103,24 @@ index 1d7d033888bf8b9ff3ea1e938dc9d92fd09f2bfe..175b9704fb756747f865011a225767ae
break;
default:
@@ -1219,6 +1227,7 @@ void VideoOverlayWindowViews::SetUpViews() {
@@ -734,6 +742,7 @@ bool VideoOverlayWindowViews::ShowControlsForGestureIfNecessary(
bool VideoOverlayWindowViews::HideLiveCaptionDialogForGestureIfNecessary(
ui::GestureEvent* event) {
+#if 0
if (event->type() != ui::EventType::kGestureTap) {
return false;
}
@@ -748,6 +757,8 @@ bool VideoOverlayWindowViews::HideLiveCaptionDialogForGestureIfNecessary(
return true;
}
+ return false;
+#endif
return false;
}
@@ -1219,6 +1230,7 @@ void VideoOverlayWindowViews::SetUpViews() {
timestamp->SetBackgroundColor(SK_ColorTRANSPARENT);
timestamp->SetHorizontalAlignment(gfx::ALIGN_LEFT);
@@ -111,7 +128,7 @@ index 1d7d033888bf8b9ff3ea1e938dc9d92fd09f2bfe..175b9704fb756747f865011a225767ae
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() {
@@ -1238,6 +1250,7 @@ void VideoOverlayWindowViews::SetUpViews() {
Profile::FromBrowserContext(
controller_->GetWebContents()->GetBrowserContext()));
live_caption_dialog->SetVisible(false);
@@ -119,7 +136,7 @@ index 1d7d033888bf8b9ff3ea1e938dc9d92fd09f2bfe..175b9704fb756747f865011a225767ae
auto toggle_microphone_button =
std::make_unique<ToggleMicrophoneButton>(base::BindRepeating(
@@ -1360,13 +1370,15 @@ void VideoOverlayWindowViews::SetUpViews() {
@@ -1360,13 +1373,15 @@ void VideoOverlayWindowViews::SetUpViews() {
timestamp_ =
playback_controls_container_view_->AddChildView(std::move(timestamp));
@@ -136,7 +153,7 @@ index 1d7d033888bf8b9ff3ea1e938dc9d92fd09f2bfe..175b9704fb756747f865011a225767ae
toggle_camera_button_ = vc_controls_container_view_->AddChildView(
std::move(toggle_camera_button));
@@ -1622,6 +1634,7 @@ void VideoOverlayWindowViews::OnUpdateControlsBounds() {
@@ -1622,6 +1637,7 @@ void VideoOverlayWindowViews::OnUpdateControlsBounds() {
timestamp_->SetSize({max_timestamp_width, kTimestampHeight});
timestamp_->SetVisible(!is_live_);
@@ -144,7 +161,7 @@ index 1d7d033888bf8b9ff3ea1e938dc9d92fd09f2bfe..175b9704fb756747f865011a225767ae
live_status_->SetPosition(timestamp_position);
live_status_->SetMaximumWidthSingleLine(max_timestamp_width);
live_status_->SetSize(
@@ -1629,7 +1642,6 @@ void VideoOverlayWindowViews::OnUpdateControlsBounds() {
@@ -1629,7 +1645,6 @@ void VideoOverlayWindowViews::OnUpdateControlsBounds() {
.width(),
kTimestampHeight});
live_status_->SetVisible(is_live_);
@@ -152,7 +169,7 @@ index 1d7d033888bf8b9ff3ea1e938dc9d92fd09f2bfe..175b9704fb756747f865011a225767ae
gfx::Rect live_caption_button_bounds(
bottom_controls_bounds.right() - kBottomControlsHorizontalMargin -
kActionButtonSize.width(),
@@ -1642,7 +1654,7 @@ void VideoOverlayWindowViews::OnUpdateControlsBounds() {
@@ -1642,7 +1657,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()});
@@ -161,7 +178,7 @@ index 1d7d033888bf8b9ff3ea1e938dc9d92fd09f2bfe..175b9704fb756747f865011a225767ae
// 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 =
@@ -1971,11 +1983,13 @@ void VideoOverlayWindowViews::OnGestureEvent(ui::GestureEvent* event) {
@@ -1971,11 +1986,13 @@ void VideoOverlayWindowViews::OnGestureEvent(ui::GestureEvent* event) {
return;
}
@@ -175,7 +192,7 @@ index 1d7d033888bf8b9ff3ea1e938dc9d92fd09f2bfe..175b9704fb756747f865011a225767ae
// Otherwise, just use default gesture event handling.
views::Widget::OnGestureEvent(event);
@@ -2041,18 +2055,25 @@ gfx::Rect VideoOverlayWindowViews::GetProgressViewBounds() {
@@ -2041,18 +2058,25 @@ gfx::Rect VideoOverlayWindowViews::GetProgressViewBounds() {
}
gfx::Rect VideoOverlayWindowViews::GetLiveCaptionButtonBounds() {
@@ -201,7 +218,7 @@ index 1d7d033888bf8b9ff3ea1e938dc9d92fd09f2bfe..175b9704fb756747f865011a225767ae
MediaEngagementService* service =
MediaEngagementService::Get(Profile::FromBrowserContext(
GetController()->GetWebContents()->GetBrowserContext()));
@@ -2061,6 +2082,8 @@ bool VideoOverlayWindowViews::HasHighMediaEngagement(
@@ -2061,6 +2085,8 @@ bool VideoOverlayWindowViews::HasHighMediaEngagement(
}
return service->HasHighEngagement(origin);
@@ -210,7 +227,7 @@ index 1d7d033888bf8b9ff3ea1e938dc9d92fd09f2bfe..175b9704fb756747f865011a225767ae
}
bool VideoOverlayWindowViews::IsTrustedForMediaPlayback() const {
@@ -2317,16 +2340,20 @@ void VideoOverlayWindowViews::UpdateTimestampLabel(base::TimeDelta current_time,
@@ -2317,16 +2343,20 @@ void VideoOverlayWindowViews::UpdateTimestampLabel(base::TimeDelta current_time,
}
void VideoOverlayWindowViews::OnLiveCaptionButtonPressed() {