OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/touch_selection/touch_selection_controller.h" | 5 #include "ui/touch_selection/touch_selection_controller.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 } | 96 } |
97 | 97 |
98 void OnSelectionEvent(SelectionEventType event) override { | 98 void OnSelectionEvent(SelectionEventType event) override { |
99 events_.push_back(event); | 99 events_.push_back(event); |
100 last_event_start_ = controller_->GetStartPosition(); | 100 last_event_start_ = controller_->GetStartPosition(); |
101 last_event_end_ = controller_->GetEndPosition(); | 101 last_event_end_ = controller_->GetEndPosition(); |
102 last_event_bounds_rect_ = controller_->GetRectBetweenBounds(); | 102 last_event_bounds_rect_ = controller_->GetRectBetweenBounds(); |
103 } | 103 } |
104 | 104 |
105 std::unique_ptr<TouchHandleDrawable> CreateDrawable() override { | 105 std::unique_ptr<TouchHandleDrawable> CreateDrawable() override { |
106 return base::WrapUnique(new MockTouchHandleDrawable(&dragging_enabled_)); | 106 return base::MakeUnique<MockTouchHandleDrawable>(&dragging_enabled_); |
107 } | 107 } |
108 | 108 |
109 void EnableLongPressDragSelection() { | 109 void EnableLongPressDragSelection() { |
110 TouchSelectionController::Config config = DefaultConfig(); | 110 TouchSelectionController::Config config = DefaultConfig(); |
111 config.enable_longpress_drag_selection = true; | 111 config.enable_longpress_drag_selection = true; |
112 controller_.reset(new TouchSelectionController(this, config)); | 112 controller_.reset(new TouchSelectionController(this, config)); |
113 } | 113 } |
114 | 114 |
115 void SetAnimationEnabled(bool enabled) { animation_enabled_ = enabled; } | 115 void SetAnimationEnabled(bool enabled) { animation_enabled_ = enabled; } |
116 void SetDraggingEnabled(bool enabled) { dragging_enabled_ = enabled; } | 116 void SetDraggingEnabled(bool enabled) { dragging_enabled_ = enabled; } |
(...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1444 offset_rect.x(), offset_rect.bottom()); | 1444 offset_rect.x(), offset_rect.bottom()); |
1445 EXPECT_TRUE(controller().WillHandleTouchEvent(event)); | 1445 EXPECT_TRUE(controller().WillHandleTouchEvent(event)); |
1446 EXPECT_THAT(GetAndResetEvents(), ElementsAre(SELECTION_HANDLE_DRAG_STOPPED)); | 1446 EXPECT_THAT(GetAndResetEvents(), ElementsAre(SELECTION_HANDLE_DRAG_STOPPED)); |
1447 EXPECT_EQ(test_controller.GetStartHandleOrientation(), | 1447 EXPECT_EQ(test_controller.GetStartHandleOrientation(), |
1448 TouchHandleOrientation::LEFT); | 1448 TouchHandleOrientation::LEFT); |
1449 EXPECT_EQ(test_controller.GetEndHandleOrientation(), | 1449 EXPECT_EQ(test_controller.GetEndHandleOrientation(), |
1450 TouchHandleOrientation::RIGHT); | 1450 TouchHandleOrientation::RIGHT); |
1451 } | 1451 } |
1452 | 1452 |
1453 } // namespace ui | 1453 } // namespace ui |
OLD | NEW |