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/test/ink_drop_host_view_test_api.h" | 5 #include "ui/views/animation/test/ink_drop_host_view_test_api.h" |
6 | 6 |
7 namespace views { | 7 namespace views { |
8 namespace test { | 8 namespace test { |
9 | 9 |
10 InkDropHostViewTestApi::InkDropHostViewTestApi(InkDropHostView* host_view) | 10 InkDropHostViewTestApi::InkDropHostViewTestApi(InkDropHostView* host_view) |
11 : host_view_(host_view) {} | 11 : host_view_(host_view) {} |
12 | 12 |
13 InkDropHostViewTestApi::~InkDropHostViewTestApi() {} | 13 InkDropHostViewTestApi::~InkDropHostViewTestApi() {} |
14 | 14 |
15 void InkDropHostViewTestApi::SetHasInkDrop(bool has_an_ink_drop) { | 15 void InkDropHostViewTestApi::SetHasInkDrop(bool has_an_ink_drop) { |
16 host_view_->SetHasInkDrop(has_an_ink_drop); | 16 host_view_->SetHasInkDrop( |
| 17 has_an_ink_drop ? InkDropHostView::INK_DROP_WITH_GESTURE_HANDLING |
| 18 : InkDropHostView::NO_INK_DROP); |
| 19 } |
| 20 |
| 21 void InkDropHostViewTestApi::SetInkDrop(std::unique_ptr<InkDrop> ink_drop, |
| 22 bool handles_gesture_events) { |
| 23 host_view_->SetHasInkDrop( |
| 24 handles_gesture_events |
| 25 ? InkDropHostView::INK_DROP_WITH_GESTURE_HANDLING |
| 26 : InkDropHostView::INK_DROP_WITHOUT_GESTURE_HANDLING); |
| 27 host_view_->ink_drop_ = std::move(ink_drop); |
17 } | 28 } |
18 | 29 |
19 void InkDropHostViewTestApi::SetInkDrop(std::unique_ptr<InkDrop> ink_drop) { | 30 void InkDropHostViewTestApi::SetInkDrop(std::unique_ptr<InkDrop> ink_drop) { |
20 host_view_->SetHasInkDrop(true); | 31 SetInkDrop(std::move(ink_drop), true); |
21 host_view_->ink_drop_ = std::move(ink_drop); | |
22 } | 32 } |
23 | 33 |
24 bool InkDropHostViewTestApi::HasGestureHandler() const { | 34 bool InkDropHostViewTestApi::HasGestureHandler() const { |
25 return host_view_->gesture_handler_ != nullptr; | 35 return host_view_->gesture_handler_ != nullptr; |
26 } | 36 } |
27 | 37 |
28 gfx::Point InkDropHostViewTestApi::GetInkDropCenterBasedOnLastEvent() const { | 38 gfx::Point InkDropHostViewTestApi::GetInkDropCenterBasedOnLastEvent() const { |
29 return host_view_->GetInkDropCenterBasedOnLastEvent(); | 39 return host_view_->GetInkDropCenterBasedOnLastEvent(); |
30 } | 40 } |
31 | 41 |
32 void InkDropHostViewTestApi::AnimateInkDrop(InkDropState state, | 42 void InkDropHostViewTestApi::AnimateInkDrop(InkDropState state, |
33 const ui::LocatedEvent* event) { | 43 const ui::LocatedEvent* event) { |
34 host_view_->AnimateInkDrop(state, event); | 44 host_view_->AnimateInkDrop(state, event); |
35 } | 45 } |
36 | 46 |
37 } // namespace test | 47 } // namespace test |
38 } // namespace views | 48 } // namespace views |
OLD | NEW |