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 25 matching lines...) Expand all Loading... |
36 | 36 |
37 void ButtonInkDropDelegate::OnLayout() { | 37 void ButtonInkDropDelegate::OnLayout() { |
38 ink_drop_animation_controller_->SetInkDropCenter( | 38 ink_drop_animation_controller_->SetInkDropCenter( |
39 ink_drop_host_->CalculateInkDropCenter()); | 39 ink_drop_host_->CalculateInkDropCenter()); |
40 } | 40 } |
41 | 41 |
42 void ButtonInkDropDelegate::OnAction(InkDropState state) { | 42 void ButtonInkDropDelegate::OnAction(InkDropState state) { |
43 ink_drop_animation_controller_->AnimateToState(state); | 43 ink_drop_animation_controller_->AnimateToState(state); |
44 } | 44 } |
45 | 45 |
| 46 void ButtonInkDropDelegate::SetHovered(bool is_hovered) { |
| 47 ink_drop_animation_controller_->SetHovered(is_hovered); |
| 48 } |
| 49 |
46 //////////////////////////////////////////////////////////////////////////////// | 50 //////////////////////////////////////////////////////////////////////////////// |
47 // ui::EventHandler: | 51 // ui::EventHandler: |
48 | 52 |
49 void ButtonInkDropDelegate::OnGestureEvent(ui::GestureEvent* event) { | 53 void ButtonInkDropDelegate::OnGestureEvent(ui::GestureEvent* event) { |
50 InkDropState current_ink_drop_state = | 54 InkDropState current_ink_drop_state = |
51 ink_drop_animation_controller_->GetInkDropState(); | 55 ink_drop_animation_controller_->GetInkDropState(); |
52 | 56 |
53 InkDropState ink_drop_state = InkDropState::HIDDEN; | 57 InkDropState ink_drop_state = InkDropState::HIDDEN; |
54 switch (event->type()) { | 58 switch (event->type()) { |
55 case ui::ET_GESTURE_TAP_DOWN: | 59 case ui::ET_GESTURE_TAP_DOWN: |
(...skipping 25 matching lines...) Expand all Loading... |
81 current_ink_drop_state == InkDropState::DEACTIVATED)) { | 85 current_ink_drop_state == InkDropState::DEACTIVATED)) { |
82 // These InkDropStates automatically transition to the HIDDEN state so we | 86 // These InkDropStates automatically transition to the HIDDEN state so we |
83 // don't make an explicit call. Explicitly animating to HIDDEN in this case | 87 // don't make an explicit call. Explicitly animating to HIDDEN in this case |
84 // would prematurely pre-empt these animations. | 88 // would prematurely pre-empt these animations. |
85 return; | 89 return; |
86 } | 90 } |
87 ink_drop_animation_controller_->AnimateToState(ink_drop_state); | 91 ink_drop_animation_controller_->AnimateToState(ink_drop_state); |
88 } | 92 } |
89 | 93 |
90 } // namespace views | 94 } // namespace views |
OLD | NEW |