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

Unified Diff: chrome/browser/ui/views/toolbar/toolbar_actions_bar_bubble_views.cc

Issue 2827603005: Cater for the "double close" when clicking "Learn More" on auto-dismiss extension bubbles. (Closed)
Patch Set: nit comment Created 3 years, 8 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 | « chrome/browser/ui/views/extensions/extension_message_bubble_view_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/toolbar/toolbar_actions_bar_bubble_views.cc
diff --git a/chrome/browser/ui/views/toolbar/toolbar_actions_bar_bubble_views.cc b/chrome/browser/ui/views/toolbar/toolbar_actions_bar_bubble_views.cc
index 8842a43d252a97c2bfbc1c7029109a0e5aaec212..624106a496252f78c975ec7b3e76dac23790796f 100644
--- a/chrome/browser/ui/views/toolbar/toolbar_actions_bar_bubble_views.cc
+++ b/chrome/browser/ui/views/toolbar/toolbar_actions_bar_bubble_views.cc
@@ -101,7 +101,11 @@ bool ToolbarActionsBarBubbleViews::Accept() {
}
bool ToolbarActionsBarBubbleViews::Close() {
- delegate_->OnBubbleClosed(close_reason_);
+ // When LinkClicked() calls OnBubbleClosed(), the Widget may close
Devlin 2017/04/19 15:04:22 This sounds a bit off to me. Maybe "delegate_->On
tapted 2017/04/20 11:55:42 Done.
+ // automatically in response to the delegate action (e.g. losing focus when
+ // a browser is raised).
Devlin 2017/04/19 15:04:22 browser is raised -> tab is opened?
tapted 2017/04/20 11:55:42 Done.
+ if (close_reason_ != ToolbarActionsBarBubbleDelegate::CLOSE_LEARN_MORE)
Devlin 2017/04/19 15:04:22 close_reason_ is only set for LinkClicked(), which
tapted 2017/04/20 11:55:41 I went for a bool. Called it |delegate_notified_of
+ delegate_->OnBubbleClosed(close_reason_);
return true;
}
@@ -160,5 +164,12 @@ base::string16 ToolbarActionsBarBubbleViews::GetDialogButtonLabel(
void ToolbarActionsBarBubbleViews::LinkClicked(views::Link* link,
int event_flags) {
close_reason_ = ToolbarActionsBarBubbleDelegate::CLOSE_LEARN_MORE;
+ // Force the delegate action to happen here rather than in Close() so that
+ // Close() can distinguish between the codepaths.
Devlin 2017/04/19 15:04:22 I don't follow the "so that Close() can distinguis
tapted 2017/04/20 11:55:41 I think this captures it: // Force the delegate
+ delegate_->OnBubbleClosed(close_reason_);
+ // Note that the Widget may or may not already be closed at this point,
+ // depending on delegate_->ShouldCloseOnDeactivate(). Widget::Close() protects
+ // against multiple calls (so long as they are not nested), and Widget
+ // destruction is asynchronous, so it is safe to call Close() again.
GetWidget()->Close();
}
« no previous file with comments | « chrome/browser/ui/views/extensions/extension_message_bubble_view_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698