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

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

Issue 1778643002: Moved AppMenu ACTIVATED/DEACTIVATED ink drop handling in to MenuButton. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed compile time typo 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 473d42315b8398727a4c081d7119eada8865fe31..ffcf9b78d99751b6cb5532f9eeaf0353d797525f 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() {

Powered by Google App Engine
This is Rietveld 408576698