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

Unified Diff: content/browser/renderer_host/input/synthetic_smooth_drag_gesture.cc

Issue 929333002: Adding synthetic touch/mouse drag [Part1] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing errors. Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698