Allow configurable behavior on PageInfo bubble close.
In normal browser cases, when the user backs out of the page info
dialog, in some cases focus needs to be returned to the security chip/
location bar. In PWA/focus mode, since the page/app info dialog is
launched from the three-dot app menu, focus needs to instead return to
the web contents pane. (See attached bug for example.)
This is a more general fix to a spot fix introduced in
https://chromium-review.googlesource.com/c/chromium/src/+/1362499
to solve issue 910067.
We create a general system because the behavior is (a) substantively
different depending on the calling context, and (b) often relies on
code/access to views specific to the caller.
Bug: 949066
Change-Id: Ideb8fdcb8ec09c580845b3c83c44eb3ab6c76ec4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1600081
Commit-Queue: Dana Fried <[email protected]>
Reviewed-by: Elly Fong-Jones <[email protected]>
Reviewed-by: Emily Stark <[email protected]>
Cr-Commit-Position: refs/heads/master@{#658664}
diff --git a/chrome/browser/ui/page_info/page_info.cc b/chrome/browser/ui/page_info/page_info.cc
index 3ccf350..9d7c5ce 100644
--- a/chrome/browser/ui/page_info/page_info.cc
+++ b/chrome/browser/ui/page_info/page_info.cc
@@ -513,15 +513,20 @@
PresentSiteData();
}
-void PageInfo::OnUIClosing() {
+void PageInfo::OnUIClosing(bool* reload_prompt) {
+ if (reload_prompt)
+ *reload_prompt = false;
#if defined(OS_ANDROID)
NOTREACHED();
#else
if (show_info_bar_ && web_contents() && !web_contents()->IsBeingDestroyed()) {
InfoBarService* infobar_service =
InfoBarService::FromWebContents(web_contents());
- if (infobar_service)
+ if (infobar_service) {
PageInfoInfoBarDelegate::Create(infobar_service);
+ if (reload_prompt)
+ *reload_prompt = true;
+ }
}
#endif
}