| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ink_drop.h" | |
| 6 #include "ui/views/animation/test/test_ink_drop_delegate.h" | 5 #include "ui/views/animation/test/test_ink_drop_delegate.h" |
| 7 | 6 |
| 8 namespace views { | 7 namespace views { |
| 9 namespace test { | 8 namespace test { |
| 10 | 9 |
| 11 class TestInkDrop : public InkDrop { | 10 TestInkDropDelegate::TestInkDropDelegate() {} |
| 12 public: | |
| 13 TestInkDrop() : InkDrop() {} | |
| 14 ~TestInkDrop() override {} | |
| 15 | |
| 16 InkDropState GetTargetInkDropState() const override { | |
| 17 NOTREACHED(); | |
| 18 return InkDropState::HIDDEN; | |
| 19 } | |
| 20 | |
| 21 bool IsVisible() const override { | |
| 22 NOTREACHED(); | |
| 23 return false; | |
| 24 } | |
| 25 void AnimateToState(InkDropState ink_drop_state) override { NOTREACHED(); } | |
| 26 void SnapToActivated() override { NOTREACHED(); } | |
| 27 void SetHovered(bool is_hovered) override { NOTREACHED(); } | |
| 28 void SetFocused(bool is_focused) override {} | |
| 29 | |
| 30 private: | |
| 31 DISALLOW_COPY_AND_ASSIGN(TestInkDrop); | |
| 32 }; | |
| 33 | |
| 34 TestInkDropDelegate::TestInkDropDelegate() | |
| 35 : state_(InkDropState::HIDDEN), is_hovered_(false) {} | |
| 36 | 11 |
| 37 TestInkDropDelegate::~TestInkDropDelegate() {} | 12 TestInkDropDelegate::~TestInkDropDelegate() {} |
| 38 | 13 |
| 39 void TestInkDropDelegate::OnAction(InkDropState state) { | 14 void TestInkDropDelegate::OnAction(InkDropState state) { |
| 40 state_ = state; | 15 ink_drop_.AnimateToState(state); |
| 41 } | 16 } |
| 42 | 17 |
| 43 void TestInkDropDelegate::SnapToActivated() { | 18 void TestInkDropDelegate::SnapToActivated() { |
| 44 state_ = InkDropState::ACTIVATED; | 19 ink_drop_.SnapToActivated(); |
| 45 } | 20 } |
| 46 | 21 |
| 47 void TestInkDropDelegate::SetHovered(bool is_hovered) { | 22 void TestInkDropDelegate::SetHovered(bool is_hovered) { |
| 48 is_hovered_ = is_hovered; | 23 ink_drop_.SetHovered(is_hovered); |
| 49 } | 24 } |
| 50 | 25 |
| 51 InkDropState TestInkDropDelegate::GetTargetInkDropState() const { | 26 InkDropState TestInkDropDelegate::GetTargetInkDropState() const { |
| 52 return state_; | 27 return ink_drop_.GetTargetInkDropState(); |
| 53 } | 28 } |
| 54 | 29 |
| 55 InkDrop* TestInkDropDelegate::GetInkDrop() { | 30 InkDrop* TestInkDropDelegate::GetInkDrop() { |
| 56 if (!ink_drop_.get()) | 31 return &ink_drop_; |
| 57 ink_drop_.reset(new TestInkDrop); | |
| 58 return ink_drop_.get(); | |
| 59 } | 32 } |
| 60 | 33 |
| 61 } // namespace test | 34 } // namespace test |
| 62 } // namespace views | 35 } // namespace views |
| OLD | NEW |