Index: ui/touch_selection/touch_selection_controller.cc |
diff --git a/ui/touch_selection/touch_selection_controller.cc b/ui/touch_selection/touch_selection_controller.cc |
index c98d485160c4be3aa4e05dc3c1195e0ddbd1b9cd..3e065b89446d1c2fe517e91efe9041a8f69d385c 100644 |
--- a/ui/touch_selection/touch_selection_controller.cc |
+++ b/ui/touch_selection/touch_selection_controller.cc |
@@ -332,7 +332,52 @@ const gfx::PointF& TouchSelectionController::GetEndPosition() const { |
return end_.edge_bottom(); |
} |
-void TouchSelectionController::OnDragBegin( |
+void TouchSelectionController::OnDragEvent( |
+ const TouchHandleDragEvent event, |
+ const TouchSelectionDraggable& draggable, |
+ const gfx::PointF& position) { |
+ switch (event) { |
+ case HANDLE_DRAG_BEGIN: |
+ HandleDragBegin(draggable, position); |
+ break; |
+ case HANDLE_DRAG_UPDATE: |
+ HandleDragUpdate(draggable, position); |
+ break; |
+ case HANDLE_DRAG_END: |
+ HandleDragEnd(draggable); |
+ default: |
+ NOTREACHED() << "Invalid handle drag event"; |
+ } |
+} |
+ |
+bool TouchSelectionController::IsWithinTapSlop( |
+ const gfx::Vector2dF& delta) const { |
+ return delta.LengthSquared() < |
+ (static_cast<double>(config_.tap_slop) * config_.tap_slop); |
+} |
+ |
+void TouchSelectionController::OnHandleTapped(const TouchHandle& handle) { |
+ if (insertion_handle_ && &handle == insertion_handle_.get()) |
+ client_->OnSelectionEvent(INSERTION_HANDLE_TAPPED); |
+} |
+ |
+void TouchSelectionController::SetNeedsAnimate() { |
+ client_->SetNeedsAnimate(); |
+} |
+ |
+scoped_ptr<TouchHandleDrawable> TouchSelectionController::CreateDrawable() { |
+ return client_->CreateDrawable(); |
+} |
+ |
+base::TimeDelta TouchSelectionController::GetMaxTapDuration() const { |
+ return config_.max_tap_duration; |
+} |
+ |
+bool TouchSelectionController::IsAdaptiveHandleOrientationEnabled() const { |
+ return config_.enable_adaptive_handle_orientation; |
+} |
+ |
+void TouchSelectionController::HandleDragBegin( |
const TouchSelectionDraggable& draggable, |
const gfx::PointF& drag_position) { |
if (&draggable == insertion_handle_.get()) { |
@@ -368,7 +413,7 @@ void TouchSelectionController::OnDragBegin( |
client_->OnSelectionEvent(SELECTION_HANDLE_DRAG_STARTED); |
} |
-void TouchSelectionController::OnDragUpdate( |
+void TouchSelectionController::HandleDragUpdate( |
const TouchSelectionDraggable& draggable, |
const gfx::PointF& drag_position) { |
// As the position corresponds to the bottom left point of the selection |
@@ -383,7 +428,7 @@ void TouchSelectionController::OnDragUpdate( |
client_->MoveRangeSelectionExtent(line_position); |
} |
-void TouchSelectionController::OnDragEnd( |
+void TouchSelectionController::HandleDragEnd( |
const TouchSelectionDraggable& draggable) { |
if (&draggable == insertion_handle_.get()) |
client_->OnSelectionEvent(INSERTION_HANDLE_DRAG_STOPPED); |
@@ -391,33 +436,6 @@ void TouchSelectionController::OnDragEnd( |
client_->OnSelectionEvent(SELECTION_HANDLE_DRAG_STOPPED); |
} |
-bool TouchSelectionController::IsWithinTapSlop( |
- const gfx::Vector2dF& delta) const { |
- return delta.LengthSquared() < |
- (static_cast<double>(config_.tap_slop) * config_.tap_slop); |
-} |
- |
-void TouchSelectionController::OnHandleTapped(const TouchHandle& handle) { |
- if (insertion_handle_ && &handle == insertion_handle_.get()) |
- client_->OnSelectionEvent(INSERTION_HANDLE_TAPPED); |
-} |
- |
-void TouchSelectionController::SetNeedsAnimate() { |
- client_->SetNeedsAnimate(); |
-} |
- |
-scoped_ptr<TouchHandleDrawable> TouchSelectionController::CreateDrawable() { |
- return client_->CreateDrawable(); |
-} |
- |
-base::TimeDelta TouchSelectionController::GetMaxTapDuration() const { |
- return config_.max_tap_duration; |
-} |
- |
-bool TouchSelectionController::IsAdaptiveHandleOrientationEnabled() const { |
- return config_.enable_adaptive_handle_orientation; |
-} |
- |
void TouchSelectionController::OnLongPressDragActiveStateChanged() { |
// The handles should remain hidden for the duration of a longpress drag, |
// including the time between a longpress and the start of drag motion. |