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

Unified Diff: ui/views/controls/button/custom_button.cc

Issue 1478303003: Converted all Views to use an InkDropDelegate instead of a InkDropAnimationController. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merged with master / https://codereview.chromium.org/1494433003. Created 5 years 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: ui/views/controls/button/custom_button.cc
diff --git a/ui/views/controls/button/custom_button.cc b/ui/views/controls/button/custom_button.cc
index e8ce4a003e394c3ff8f5ae260888f8806ddf8b1c..15f785d57952fadfa5289594f504ce2790e93903 100644
--- a/ui/views/controls/button/custom_button.cc
+++ b/ui/views/controls/button/custom_button.cc
@@ -143,8 +143,11 @@ const char* CustomButton::GetClassName() const {
bool CustomButton::OnMousePressed(const ui::MouseEvent& event) {
if (state_ == STATE_DISABLED)
return true;
- if (ShouldEnterPushedState(event) && HitTestPoint(event.location()))
+ if (ShouldEnterPushedState(event) && HitTestPoint(event.location())) {
SetState(STATE_PRESSED);
+ if (ink_drop_delegate_)
+ ink_drop_delegate_->OnAction(views::InkDropState::ACTION_PENDING);
+ }
if (request_focus_on_press_)
RequestFocus();
if (IsTriggerableEvent(event) && notify_action_ == NOTIFY_ON_PRESS) {
@@ -405,6 +408,18 @@ void CustomButton::OnBlur() {
SetState(STATE_NORMAL);
}
+void CustomButton::NotifyClick(const ui::Event& event) {
+ Button::NotifyClick(event);
+ if (ink_drop_delegate())
+ ink_drop_delegate()->OnAction(views::InkDropState::QUICK_ACTION);
varkha 2015/12/09 21:23:36 Wouldn't it make sense to start animating before b
bruthig 2015/12/11 22:09:46 Done.
+}
+
+void CustomButton::OnClickCanceled(const ui::Event& event) {
+ Button::OnClickCanceled(event);
+ if (ink_drop_delegate())
+ ink_drop_delegate()->OnAction(views::InkDropState::HIDDEN);
+}
+
bool CustomButton::IsChildWidget() const {
return GetWidget() && GetWidget()->GetTopLevelWidget() != GetWidget();
}

Powered by Google App Engine
This is Rietveld 408576698