Chromium Code Reviews| 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..4b3f003bedfad7e816f7f7f69d1f522899361647 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 |
| @@ -59,6 +59,11 @@ using ChosenObjectDeleteCallback = |
| namespace { |
| +// 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 is_popup_showing = false; |
|
tapted
2016/06/06 05:06:37
g_is_popup_showing. Also move down to the end of t
dominickn
2016/06/08 03:03:08
Done.
|
| + |
| // The default width of the window, in view coordinates. It may be larger to |
| // fit the content. |
| const CGFloat kDefaultWindowWidth = 310; |
| @@ -230,6 +235,7 @@ NSPoint AnchorPointForWindow(NSWindow* parent) { |
| if (presenter_.get()) |
| presenter_->OnUIClosing(); |
| presenter_.reset(); |
| + is_popup_showing = false; |
| [super windowWillClose:notification]; |
| } |
| @@ -1099,6 +1105,7 @@ WebsiteSettingsUIBridge::WebsiteSettingsUIBridge( |
| bubble_controller_(nil) {} |
| WebsiteSettingsUIBridge::~WebsiteSettingsUIBridge() { |
| + is_popup_showing = false; |
|
tapted
2016/06/06 05:06:37
why is this needed twice? Can we just tie the life
dominickn
2016/06/08 03:03:08
Done.
|
| } |
| void WebsiteSettingsUIBridge::set_bubble_controller( |
| @@ -1119,6 +1126,14 @@ void WebsiteSettingsUIBridge::Show( |
| return; |
| } |
| + // If the WebsiteSettings are already being shown, don't show them again. |
| + // This effectively means that clicking on the location icon when |
| + // WebsiteSettings is already visible dismisses the open popup, destroying |
| + // this object and setting |is_popup_showing| to false. |
| + if (is_popup_showing) |
| + return; |
| + |
| + is_popup_showing = true; |
| BubbleType bubble_type = WEB_PAGE; |
| if (virtual_url.SchemeIs(content::kChromeUIScheme)) |
| bubble_type = INTERNAL_PAGE; |