Fix regression in BubbleContentsWrapper.
The BubbleContentsWrapper code was moved from RenderViewHostChanged to
RenderFrameHostChanged, which are supposed to be identical events.
Unfortunately, in some specific cases (which we are actually aiming to
remove), the RenderViewHostChanged event was being fired and the code
in this class depended on that behavior. It turns out that this behavior
does not exist with RenderFrameHostChanged, so it was not as safe of a
transformation as I expected. PrimaryPageChanged, which is long term the
best event to listen to for when a WebContents navigates the main frame,
also has the behavior BubbleContentsWrapper is looking for. This CL moves
the implementation to this event instead of RenderFrameHostChanged.
Bug: 1168562, 1394513, 1400789
Change-Id: I7c456768495c059a149a2401f1dcd2af174b9a2c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4104405
Auto-Submit: Nasko Oskov <nasko@chromium.org>
Commit-Queue: Yuheng Huang <yuhengh@chromium.org>
Commit-Queue: Nasko Oskov <nasko@chromium.org>
Reviewed-by: Yuheng Huang <yuhengh@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1082855}
diff --git a/chrome/browser/ui/views/bubble/bubble_contents_wrapper.cc b/chrome/browser/ui/views/bubble/bubble_contents_wrapper.cc
index 3e5c9999..4c53800 100644
--- a/chrome/browser/ui/views/bubble/bubble_contents_wrapper.cc
+++ b/chrome/browser/ui/views/bubble/bubble_contents_wrapper.cc
@@ -96,9 +96,7 @@
return true;
}
-void BubbleContentsWrapper::RenderFrameHostChanged(
- content::RenderFrameHost* old_host,
- content::RenderFrameHost* new_host) {
+void BubbleContentsWrapper::PrimaryPageChanged(content::Page& page) {
content::RenderWidgetHostView* render_widget_host_view =
web_contents_->GetRenderWidgetHostView();
if (!webui_resizes_host_ || !render_widget_host_view)
diff --git a/chrome/browser/ui/views/bubble/bubble_contents_wrapper.h b/chrome/browser/ui/views/bubble/bubble_contents_wrapper.h
index be650bd..188ef6d 100644
--- a/chrome/browser/ui/views/bubble/bubble_contents_wrapper.h
+++ b/chrome/browser/ui/views/bubble/bubble_contents_wrapper.h
@@ -66,8 +66,7 @@
const content::ContextMenuParams& params) override;
// content::WebContentsObserver:
- void RenderFrameHostChanged(content::RenderFrameHost* old_host,
- content::RenderFrameHost* new_host) override;
+ void PrimaryPageChanged(content::Page& page) override;
void PrimaryMainFrameRenderProcessGone(
base::TerminationStatus status) override;