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

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

Issue 2762893002: Fix a lifetime issue in ToolbarActionsBarBubbleViews (Closed)
Patch Set: Update comment Created 3 years, 9 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/toolbar/toolbar_actions_bar_bubble_views.h ('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 23396652cda7bb461715cf584df94e793406ab0a..4dc0d68943f09b23a1316ef2830e21b497dd6406 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
@@ -4,7 +4,6 @@
#include "chrome/browser/ui/views/toolbar/toolbar_actions_bar_bubble_views.h"
-#include "chrome/browser/ui/toolbar/toolbar_actions_bar_bubble_delegate.h"
#include "chrome/browser/ui/views/harmony/layout_delegate.h"
#include "chrome/grit/locale_settings.h"
#include "ui/base/resource/resource_bundle.h"
@@ -28,6 +27,8 @@ ToolbarActionsBarBubbleViews::ToolbarActionsBarBubbleViews(
: views::BubbleDialogDelegateView(anchor_view,
views::BubbleBorder::TOP_RIGHT),
delegate_(std::move(delegate)),
+ close_reason_(
+ ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS_DEACTIVATION),
item_list_(nullptr),
link_(nullptr),
anchored_to_action_(anchored_to_action) {
@@ -100,10 +101,7 @@ bool ToolbarActionsBarBubbleViews::Accept() {
}
bool ToolbarActionsBarBubbleViews::Close() {
- if (delegate_) {
- delegate_->OnBubbleClosed(
- ToolbarActionsBarBubbleDelegate::CLOSE_DISMISS_DEACTIVATION);
- }
+ delegate_->OnBubbleClosed(close_reason_);
return true;
}
@@ -163,8 +161,6 @@ base::string16 ToolbarActionsBarBubbleViews::GetDialogButtonLabel(
void ToolbarActionsBarBubbleViews::LinkClicked(views::Link* link,
int event_flags) {
- delegate_->OnBubbleClosed(ToolbarActionsBarBubbleDelegate::CLOSE_LEARN_MORE);
- // Reset delegate so we don't send extra OnBubbleClosed()s.
- delegate_.reset();
+ close_reason_ = ToolbarActionsBarBubbleDelegate::CLOSE_LEARN_MORE;
Finnur 2017/03/22 10:56:04 Have you verified none of the different ways of cl
tapted 2017/03/23 00:07:06 The test coverage for this is pretty good. Eg. Tes
GetWidget()->Close();
}
« no previous file with comments | « chrome/browser/ui/views/toolbar/toolbar_actions_bar_bubble_views.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698