Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Unified Diff: chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm

Issue 2041723002: [Mac] Dismiss an open page info dialog when the location icon is clicked. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address nit Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/views/browser_dialogs_views_mac.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm
diff --git a/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm b/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm
index 0fda37cabed9a730b9eb0e3b1001b244993f3f43..9e9e2462a38226a604b3ebc93df677e71fc726b5 100644
--- a/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm
+++ b/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm
@@ -110,6 +110,11 @@ const CGFloat kPermissionPopUpXSpacing = 3;
// |IDS_WEBSITE_SETTINGS_{FIRST,THIRD}_PARTY_SITE_DATA| next to each other.
const CGFloat kTextLabelXPadding = 5;
+// NOTE: This assumes that there will never be more than one website settings
+// popup shown, and that the one that is shown is associated with the current
+// window. This matches the behaviour in views: see WebsiteSettingsPopupView.
+bool g_is_popup_showing = false;
+
// Takes in the parent window, which should be a BrowserWindow, and gets the
// proper anchor point for the bubble. The returned point is in screen
// coordinates.
@@ -1096,9 +1101,14 @@ WebsiteSettingsUIBridge::WebsiteSettingsUIBridge(
content::WebContents* web_contents)
: content::WebContentsObserver(web_contents),
web_contents_(web_contents),
- bubble_controller_(nil) {}
+ bubble_controller_(nil) {
+ DCHECK(!g_is_popup_showing);
+ g_is_popup_showing = true;
+}
WebsiteSettingsUIBridge::~WebsiteSettingsUIBridge() {
+ DCHECK(g_is_popup_showing);
+ g_is_popup_showing = false;
}
void WebsiteSettingsUIBridge::set_bubble_controller(
@@ -1119,6 +1129,12 @@ void WebsiteSettingsUIBridge::Show(
return;
}
+ // Don't show the popup if it's already being shown. Since this method is
+ // called each time the location icon is clicked, each click toggles the popup
+ // in and out.
+ if (g_is_popup_showing)
+ return;
+
BubbleType bubble_type = WEB_PAGE;
if (virtual_url.SchemeIs(content::kChromeUIScheme))
bubble_type = INTERNAL_PAGE;
@@ -1131,7 +1147,8 @@ void WebsiteSettingsUIBridge::Show(
bool is_devtools_disabled =
profile->GetPrefs()->GetBoolean(prefs::kDevToolsDisabled);
- // Create the bubble controller. It will dealloc itself when it closes.
+ // Create the bubble controller. It will dealloc itself when it closes,
+ // resetting |g_is_popup_showing|.
WebsiteSettingsBubbleController* bubble_controller =
[[WebsiteSettingsBubbleController alloc]
initWithParentWindow:parent
« no previous file with comments | « no previous file | chrome/browser/ui/views/browser_dialogs_views_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698