Index: content/browser/renderer_host/input/synthetic_smooth_drag_gesture.cc |
diff --git a/content/browser/renderer_host/input/synthetic_smooth_drag_gesture.cc b/content/browser/renderer_host/input/synthetic_smooth_drag_gesture.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e67ec47f160f840533478429dc547da273fd372c |
--- /dev/null |
+++ b/content/browser/renderer_host/input/synthetic_smooth_drag_gesture.cc |
@@ -0,0 +1,45 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "content/browser/renderer_host/input/synthetic_smooth_drag_gesture.h" |
+ |
+namespace content { |
+ |
+SyntheticSmoothDragGesture::SyntheticSmoothDragGesture( |
+ const SyntheticSmoothDragGestureParams& params) |
+ : SyntheticSmoothMoveGesture(params.gesture_source_type, |
+ params.start_point, |
+ params.distances, |
+ params.speed_in_pixels_s, |
+ true), |
+ params_(params) { |
+} |
+ |
+SyntheticSmoothDragGesture::~SyntheticSmoothDragGesture() { |
+} |
+ |
+SyntheticGesture::Result SyntheticSmoothDragGesture::ForwardInputEvents( |
+ const base::TimeTicks& timestamp, SyntheticGestureTarget* target) { |
+ if (state_ == SETUP) { |
+ if (gesture_source_type_ == SyntheticGestureParams::DEFAULT_INPUT) |
+ gesture_source_type_ = target->GetDefaultSyntheticGestureSourceType(); |
+ |
+ state_ = STARTED; |
+ current_move_segment_ = -1; |
+ current_move_segment_stop_time_ = timestamp; |
+ } |
+ |
+ DCHECK_NE(gesture_source_type_, SyntheticGestureParams::DEFAULT_INPUT); |
+ if (gesture_source_type_ == SyntheticGestureParams::TOUCH_INPUT) |
+ ForwardTouchInputEvents(timestamp, target); |
+ else if (gesture_source_type_ == SyntheticGestureParams::MOUSE_INPUT) |
+ ForwardMouseClickInputEvents(timestamp, target); |
+ else |
+ return SyntheticGesture::GESTURE_SOURCE_TYPE_NOT_IMPLEMENTED; |
+ |
+ return (state_ == DONE) ? SyntheticGesture::GESTURE_FINISHED |
+ : SyntheticGesture::GESTURE_RUNNING; |
+} |
+ |
+} // namespace content |