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

Side by Side Diff: ui/views/controls/button/custom_button.cc

Issue 2070143003: Add MD ink drop ripple to app list button (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@b612539_shelf_button_ripple
Patch Set: Addressed review comments Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/controls/button/custom_button.h" 5 #include "ui/views/controls/button/custom_button.h"
6 6
7 #include "ui/accessibility/ax_view_state.h" 7 #include "ui/accessibility/ax_view_state.h"
8 #include "ui/base/material_design/material_design_controller.h" 8 #include "ui/base/material_design/material_design_controller.h"
9 #include "ui/events/event.h" 9 #include "ui/events/event.h"
10 #include "ui/events/event_utils.h" 10 #include "ui/events/event_utils.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 NotifyClick(event); 156 NotifyClick(event);
157 // NOTE: We may be deleted at this point (by the listener's notification 157 // NOTE: We may be deleted at this point (by the listener's notification
158 // handler). 158 // handler).
159 } 159 }
160 return true; 160 return true;
161 } 161 }
162 162
163 bool CustomButton::OnMouseDragged(const ui::MouseEvent& event) { 163 bool CustomButton::OnMouseDragged(const ui::MouseEvent& event) {
164 if (state_ != STATE_DISABLED) { 164 if (state_ != STATE_DISABLED) {
165 const bool should_enter_pushed = ShouldEnterPushedState(event); 165 const bool should_enter_pushed = ShouldEnterPushedState(event);
166 const bool should_show_pending =
167 should_enter_pushed && notify_action_ == NOTIFY_ON_RELEASE && !InDrag();
166 if (HitTestPoint(event.location())) { 168 if (HitTestPoint(event.location())) {
167 SetState(should_enter_pushed ? STATE_PRESSED : STATE_HOVERED); 169 SetState(should_enter_pushed ? STATE_PRESSED : STATE_HOVERED);
168 if (!InDrag() && should_enter_pushed && 170 if (should_show_pending &&
169 ink_drop()->GetTargetInkDropState() == views::InkDropState::HIDDEN) { 171 ink_drop()->GetTargetInkDropState() == views::InkDropState::HIDDEN) {
170 AnimateInkDrop(views::InkDropState::ACTION_PENDING, &event); 172 AnimateInkDrop(views::InkDropState::ACTION_PENDING, &event);
171 } 173 }
172 } else { 174 } else {
173 SetState(STATE_NORMAL); 175 SetState(STATE_NORMAL);
174 if (!InDrag() && should_enter_pushed && 176 if (should_show_pending &&
175 ink_drop()->GetTargetInkDropState() == 177 ink_drop()->GetTargetInkDropState() ==
176 views::InkDropState::ACTION_PENDING) { 178 views::InkDropState::ACTION_PENDING) {
177 AnimateInkDrop(views::InkDropState::HIDDEN, &event); 179 AnimateInkDrop(views::InkDropState::HIDDEN, &event);
178 } 180 }
179 } 181 }
180 } 182 }
181 return true; 183 return true;
182 } 184 }
183 185
184 void CustomButton::OnMouseReleased(const ui::MouseEvent& event) { 186 void CustomButton::OnMouseReleased(const ui::MouseEvent& event) {
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 Button::NotifyClick(event); 469 Button::NotifyClick(event);
468 } 470 }
469 471
470 void CustomButton::OnClickCanceled(const ui::Event& event) { 472 void CustomButton::OnClickCanceled(const ui::Event& event) {
471 AnimateInkDrop(views::InkDropState::HIDDEN, 473 AnimateInkDrop(views::InkDropState::HIDDEN,
472 ui::LocatedEvent::FromIfValid(&event)); 474 ui::LocatedEvent::FromIfValid(&event));
473 Button::OnClickCanceled(event); 475 Button::OnClickCanceled(event);
474 } 476 }
475 477
476 } // namespace views 478 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698