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

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

Issue 1798523003: Moved AppMenu ACTIVATED/DEACTIVATED ink drop handling in to MenuButton. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 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
Index: chrome/browser/ui/views/toolbar/app_menu_button.cc
diff --git a/chrome/browser/ui/views/toolbar/app_menu_button.cc b/chrome/browser/ui/views/toolbar/app_menu_button.cc
index 12c0e38dfdc7ac277baa9d7eda618c0c97d26bf7..2e62a2f02b58990518d636aa4055f7094e1c25f6 100644
--- a/chrome/browser/ui/views/toolbar/app_menu_button.cc
+++ b/chrome/browser/ui/views/toolbar/app_menu_button.cc
@@ -40,7 +40,6 @@ AppMenuButton::AppMenuButton(ToolbarView* toolbar_view)
toolbar_view_(toolbar_view),
allow_extension_dragging_(
extensions::FeatureSwitch::extension_action_redesign()->IsEnabled()),
- destroyed_(nullptr),
margin_trailing_(0),
ink_drop_delegate_(new views::ButtonInkDropDelegate(this, this)),
weak_factory_(this) {
@@ -49,10 +48,7 @@ AppMenuButton::AppMenuButton(ToolbarView* toolbar_view)
icon_painter_.reset(new AppMenuIconPainter(this));
}
-AppMenuButton::~AppMenuButton() {
- if (destroyed_)
- *destroyed_ = true;
-}
+AppMenuButton::~AppMenuButton() {}
void AppMenuButton::SetSeverity(AppMenuIconPainter::Severity severity,
bool animate) {
@@ -87,16 +83,6 @@ void AppMenuButton::ShowMenu(bool for_drop) {
FOR_EACH_OBSERVER(views::MenuListener, menu_listeners_, OnMenuOpened());
- // Because running the menu below spins a nested message loop, |this| can be
- // deleted by the time RunMenu() returns. To detect this, we set |destroyed_|
- // (which is normally null) to point to a local. If our destructor runs during
- // RunMenu(), then this local will be set to true on return, and we'll know
- // it's not safe to access any member variables.
- bool destroyed = false;
- destroyed_ = &destroyed;
-
- ink_drop_delegate()->OnAction(views::InkDropState::ACTIVATED);
-
base::TimeTicks menu_open_time = base::TimeTicks::Now();
menu_->RunMenu(this);
@@ -107,11 +93,6 @@ void AppMenuButton::ShowMenu(bool for_drop) {
UMA_HISTOGRAM_TIMES("Toolbar.AppMenuTimeToAction",
base::TimeTicks::Now() - menu_open_time);
}
-
- if (!destroyed) {
- ink_drop_delegate()->OnAction(views::InkDropState::DEACTIVATED);
- destroyed_ = nullptr;
- }
}
void AppMenuButton::CloseMenu() {
« no previous file with comments | « chrome/browser/ui/views/toolbar/app_menu_button.h ('k') | chrome/browser/ui/views/toolbar/toolbar_action_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698