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

Unified Diff: chrome/browser/ui/views/toolbar/toolbar_action_view.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/toolbar_action_view.cc
diff --git a/chrome/browser/ui/views/toolbar/toolbar_action_view.cc b/chrome/browser/ui/views/toolbar/toolbar_action_view.cc
index 38ee8f7031617288e34d5c38579da780da063eaa..73f9efba2564c00f13be21f97c8d0083e08aaafd 100644
--- a/chrome/browser/ui/views/toolbar/toolbar_action_view.cc
+++ b/chrome/browser/ui/views/toolbar/toolbar_action_view.cc
@@ -84,6 +84,9 @@ ToolbarActionView::ToolbarActionView(
}
ToolbarActionView::~ToolbarActionView() {
+ // Avoid access to a destroyed InkDropDelegate when the |pressed_lock_| is
+ // destroyed.
+ set_ink_drop_delegate(nullptr);
view_controller_->SetDelegate(nullptr);
}
@@ -116,8 +119,10 @@ SkColor ToolbarActionView::GetInkDropBaseColor() const {
ui::NativeTheme::kColorId_HoverMenuItemBackgroundColor);
}
- return GetThemeProvider()->GetColor(
- ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON);
+ return GetThemeProvider()
+ ? GetThemeProvider()->GetColor(
+ ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON)
+ : CustomButton::GetInkDropBaseColor();
}
bool ToolbarActionView::ShouldShowInkDropHover() const {
@@ -176,7 +181,6 @@ void ToolbarActionView::OnMenuClosed() {
menu_ = nullptr;
view_controller_->OnContextMenuClosed();
menu_adapter_.reset();
- ink_drop_delegate()->OnAction(views::InkDropState::DEACTIVATED);
}
gfx::ImageSkia ToolbarActionView::GetIconForTest() {
@@ -195,7 +199,7 @@ gfx::Size ToolbarActionView::GetPreferredSize() const {
bool ToolbarActionView::OnMousePressed(const ui::MouseEvent& event) {
// views::MenuButton actions are only triggered by left mouse clicks.
- if (event.IsOnlyLeftMouseButton()) {
+ if (event.IsOnlyLeftMouseButton() && !pressed_lock_) {
// TODO(bruthig): The ACTION_PENDING triggering logic should be in
// MenuButton::OnPressed() however there is a bug with the pressed state
// logic in MenuButton. See http://crbug.com/567252.
@@ -298,7 +302,6 @@ void ToolbarActionView::DoShowContextMenu(
delegate_->GetOverflowReferenceView()->GetWidget() :
GetWidget();
- ink_drop_delegate()->OnAction(views::InkDropState::ACTIVATED);
// Unretained() is safe here as ToolbarActionView will always outlive the
// menu. Any action that would lead to the deletion of |this| first triggers
// the closing of the menu through lost capture.
« no previous file with comments | « chrome/browser/ui/views/toolbar/app_menu_button.cc ('k') | chrome/browser/ui/views/toolbar/toolbar_action_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698