| 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 21 matching lines...) Expand all Loading... |
| 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 { | 38 InkDropState ButtonInkDropDelegate::GetTargetInkDropState() const { |
| 39 return ink_drop_->GetTargetInkDropState(); | 39 return ink_drop_->GetTargetInkDropState(); |
| 40 } | 40 } |
| 41 | 41 |
| 42 InkDrop* ButtonInkDropDelegate::GetInkDrop() { |
| 43 return ink_drop_.get(); |
| 44 } |
| 45 |
| 42 //////////////////////////////////////////////////////////////////////////////// | 46 //////////////////////////////////////////////////////////////////////////////// |
| 43 // ui::EventHandler: | 47 // ui::EventHandler: |
| 44 | 48 |
| 45 void ButtonInkDropDelegate::OnMouseEvent(ui::MouseEvent* event) { | 49 void ButtonInkDropDelegate::OnMouseEvent(ui::MouseEvent* event) { |
| 46 switch (event->type()) { | 50 switch (event->type()) { |
| 47 case ui::ET_MOUSE_ENTERED: | 51 case ui::ET_MOUSE_ENTERED: |
| 48 SetHovered(true); | 52 SetHovered(true); |
| 49 break; | 53 break; |
| 50 case ui::ET_MOUSE_EXITED: | 54 case ui::ET_MOUSE_EXITED: |
| 51 SetHovered(false); | 55 SetHovered(false); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 current_ink_drop_state == InkDropState::DEACTIVATED)) { | 95 current_ink_drop_state == InkDropState::DEACTIVATED)) { |
| 92 // These InkDropStates automatically transition to the HIDDEN state so we | 96 // These InkDropStates automatically transition to the HIDDEN state so we |
| 93 // don't make an explicit call. Explicitly animating to HIDDEN in this case | 97 // don't make an explicit call. Explicitly animating to HIDDEN in this case |
| 94 // would prematurely pre-empt these animations. | 98 // would prematurely pre-empt these animations. |
| 95 return; | 99 return; |
| 96 } | 100 } |
| 97 ink_drop_->AnimateToState(ink_drop_state); | 101 ink_drop_->AnimateToState(ink_drop_state); |
| 98 } | 102 } |
| 99 | 103 |
| 100 } // namespace views | 104 } // namespace views |
| OLD | NEW |