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