| 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.h" | 9 #include "ui/views/animation/ink_drop.h" |
| 10 #include "ui/views/animation/ink_drop_factory.h" | 10 #include "ui/views/animation/ink_drop_factory.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 } | 28 } |
| 29 | 29 |
| 30 void ButtonInkDropDelegate::SnapToActivated() { | 30 void ButtonInkDropDelegate::SnapToActivated() { |
| 31 ink_drop_->SnapToActivated(); | 31 ink_drop_->SnapToActivated(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 void ButtonInkDropDelegate::SetHovered(bool is_hovered) { | 34 void ButtonInkDropDelegate::SetHovered(bool is_hovered) { |
| 35 ink_drop_->SetHovered(is_hovered); | 35 ink_drop_->SetHovered(is_hovered); |
| 36 } | 36 } |
| 37 | 37 |
| 38 InkDropState ButtonInkDropDelegate::GetTargetInkDropState() const { |
| 39 return ink_drop_->GetTargetInkDropState(); |
| 40 } |
| 41 |
| 38 //////////////////////////////////////////////////////////////////////////////// | 42 //////////////////////////////////////////////////////////////////////////////// |
| 39 // ui::EventHandler: | 43 // ui::EventHandler: |
| 40 | 44 |
| 41 void ButtonInkDropDelegate::OnMouseEvent(ui::MouseEvent* event) { | 45 void ButtonInkDropDelegate::OnMouseEvent(ui::MouseEvent* event) { |
| 42 switch (event->type()) { | 46 switch (event->type()) { |
| 43 case ui::ET_MOUSE_ENTERED: | 47 case ui::ET_MOUSE_ENTERED: |
| 44 SetHovered(true); | 48 SetHovered(true); |
| 45 break; | 49 break; |
| 46 case ui::ET_MOUSE_EXITED: | 50 case ui::ET_MOUSE_EXITED: |
| 47 SetHovered(false); | 51 SetHovered(false); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 current_ink_drop_state == InkDropState::DEACTIVATED)) { | 91 current_ink_drop_state == InkDropState::DEACTIVATED)) { |
| 88 // These InkDropStates automatically transition to the HIDDEN state so we | 92 // These InkDropStates automatically transition to the HIDDEN state so we |
| 89 // don't make an explicit call. Explicitly animating to HIDDEN in this case | 93 // don't make an explicit call. Explicitly animating to HIDDEN in this case |
| 90 // would prematurely pre-empt these animations. | 94 // would prematurely pre-empt these animations. |
| 91 return; | 95 return; |
| 92 } | 96 } |
| 93 ink_drop_->AnimateToState(ink_drop_state); | 97 ink_drop_->AnimateToState(ink_drop_state); |
| 94 } | 98 } |
| 95 | 99 |
| 96 } // namespace views | 100 } // namespace views |
| OLD | NEW |