| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/animation/button_ink_drop_delegate.h" | 5 #include "ui/views/animation/button_ink_drop_delegate.h" |
| 6 | 6 |
| 7 #include "ui/events/event.h" | 7 #include "ui/events/event.h" |
| 8 #include "ui/events/scoped_target_handler.h" | 8 #include "ui/events/scoped_target_handler.h" |
| 9 #include "ui/views/animation/ink_drop_animation_controller.h" | 9 #include "ui/views/animation/ink_drop_animation_controller.h" |
| 10 #include "ui/views/animation/ink_drop_animation_controller_factory.h" | 10 #include "ui/views/animation/ink_drop_animation_controller_factory.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 InkDropAnimationControllerFactory::CreateInkDropAnimationController( | 22 InkDropAnimationControllerFactory::CreateInkDropAnimationController( |
| 23 ink_drop_host_)) {} | 23 ink_drop_host_)) {} |
| 24 | 24 |
| 25 ButtonInkDropDelegate::~ButtonInkDropDelegate() { | 25 ButtonInkDropDelegate::~ButtonInkDropDelegate() { |
| 26 } | 26 } |
| 27 | 27 |
| 28 void ButtonInkDropDelegate::OnAction(InkDropState state) { | 28 void ButtonInkDropDelegate::OnAction(InkDropState state) { |
| 29 ink_drop_animation_controller_->AnimateToState(state); | 29 ink_drop_animation_controller_->AnimateToState(state); |
| 30 } | 30 } |
| 31 | 31 |
| 32 void ButtonInkDropDelegate::SnapToActivated() { |
| 33 ink_drop_animation_controller_->SnapToActivated(); |
| 34 } |
| 35 |
| 32 void ButtonInkDropDelegate::SetHovered(bool is_hovered) { | 36 void ButtonInkDropDelegate::SetHovered(bool is_hovered) { |
| 33 ink_drop_animation_controller_->SetHovered(is_hovered); | 37 ink_drop_animation_controller_->SetHovered(is_hovered); |
| 34 } | 38 } |
| 35 | 39 |
| 36 //////////////////////////////////////////////////////////////////////////////// | 40 //////////////////////////////////////////////////////////////////////////////// |
| 37 // ui::EventHandler: | 41 // ui::EventHandler: |
| 38 | 42 |
| 39 void ButtonInkDropDelegate::OnMouseEvent(ui::MouseEvent* event) { | 43 void ButtonInkDropDelegate::OnMouseEvent(ui::MouseEvent* event) { |
| 40 switch (event->type()) { | 44 switch (event->type()) { |
| 41 case ui::ET_MOUSE_ENTERED: | 45 case ui::ET_MOUSE_ENTERED: |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 current_ink_drop_state == InkDropState::DEACTIVATED)) { | 88 current_ink_drop_state == InkDropState::DEACTIVATED)) { |
| 85 // These InkDropStates automatically transition to the HIDDEN state so we | 89 // These InkDropStates automatically transition to the HIDDEN state so we |
| 86 // don't make an explicit call. Explicitly animating to HIDDEN in this case | 90 // don't make an explicit call. Explicitly animating to HIDDEN in this case |
| 87 // would prematurely pre-empt these animations. | 91 // would prematurely pre-empt these animations. |
| 88 return; | 92 return; |
| 89 } | 93 } |
| 90 ink_drop_animation_controller_->AnimateToState(ink_drop_state); | 94 ink_drop_animation_controller_->AnimateToState(ink_drop_state); |
| 91 } | 95 } |
| 92 | 96 |
| 93 } // namespace views | 97 } // namespace views |
| OLD | NEW |