Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(572)

Side by Side Diff: ui/views/animation/test/test_ink_drop_delegate.cc

Issue 2017833003: Fixes ink drop being "stuck" on when losing focus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formatting changes and added NOTREACHED() macro Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 {
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
10 TestInkDropDelegate::TestInkDropDelegate() 34 TestInkDropDelegate::TestInkDropDelegate()
11 : state_(InkDropState::HIDDEN), is_hovered_(false) {} 35 : state_(InkDropState::HIDDEN), is_hovered_(false) {}
12 36
13 TestInkDropDelegate::~TestInkDropDelegate() {} 37 TestInkDropDelegate::~TestInkDropDelegate() {}
14 38
15 void TestInkDropDelegate::OnAction(InkDropState state) { 39 void TestInkDropDelegate::OnAction(InkDropState state) {
16 state_ = state; 40 state_ = state;
17 } 41 }
18 42
19 void TestInkDropDelegate::SnapToActivated() { 43 void TestInkDropDelegate::SnapToActivated() {
20 state_ = InkDropState::ACTIVATED; 44 state_ = InkDropState::ACTIVATED;
21 } 45 }
22 46
23 void TestInkDropDelegate::SetHovered(bool is_hovered) { 47 void TestInkDropDelegate::SetHovered(bool is_hovered) {
24 is_hovered_ = is_hovered; 48 is_hovered_ = is_hovered;
25 } 49 }
26 50
27 InkDropState TestInkDropDelegate::GetTargetInkDropState() const { 51 InkDropState TestInkDropDelegate::GetTargetInkDropState() const {
28 return state_; 52 return state_;
29 } 53 }
30 54
31 InkDrop* TestInkDropDelegate::GetInkDrop() { 55 InkDrop* TestInkDropDelegate::GetInkDrop() {
32 return nullptr; 56 if (!ink_drop_.get())
57 ink_drop_.reset(new TestInkDrop);
58 return ink_drop_.get();
33 } 59 }
34 60
35 } // namespace test 61 } // namespace test
36 } // namespace views 62 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/animation/test/test_ink_drop_delegate.h ('k') | ui/views/controls/button/custom_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698