Index: content/browser/renderer_host/input/synthetic_smooth_move_gesture.h |
diff --git a/content/browser/renderer_host/input/synthetic_smooth_scroll_gesture.h b/content/browser/renderer_host/input/synthetic_smooth_move_gesture.h |
similarity index 59% |
copy from content/browser/renderer_host/input/synthetic_smooth_scroll_gesture.h |
copy to content/browser/renderer_host/input/synthetic_smooth_move_gesture.h |
index da3e39e210410ffdc618d88f3962c27764db442e..ae168c995e93cae5e1bbc644f1ea01bcea6deb1d 100644 |
--- a/content/browser/renderer_host/input/synthetic_smooth_scroll_gesture.h |
+++ b/content/browser/renderer_host/input/synthetic_smooth_move_gesture.h |
@@ -2,14 +2,15 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_SMOOTH_SCROLL_GESTURE_H_ |
-#define CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_SMOOTH_SCROLL_GESTURE_H_ |
+#ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_SMOOTH_MOVE_GESTURE_H_ |
+#define CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_SMOOTH_MOVE_GESTURE_H_ |
+ |
+#include <vector> |
#include "base/time/time.h" |
#include "content/browser/renderer_host/input/synthetic_gesture.h" |
#include "content/browser/renderer_host/input/synthetic_gesture_target.h" |
#include "content/common/content_export.h" |
-#include "content/common/input/synthetic_smooth_scroll_gesture_params.h" |
#include "content/common/input/synthetic_web_input_event_builders.h" |
#include "third_party/WebKit/public/web/WebInputEvent.h" |
#include "ui/gfx/geometry/vector2d.h" |
@@ -24,17 +25,17 @@ namespace content { |
// generated. |
// When synthesizing touch events, the first distance is extended to compensate |
// for the touch slop. |
-class CONTENT_EXPORT SyntheticSmoothScrollGesture : public SyntheticGesture { |
+class CONTENT_EXPORT SyntheticSmoothMoveGesture : public SyntheticGesture { |
public: |
- explicit SyntheticSmoothScrollGesture( |
- const SyntheticSmoothScrollGestureParams& params); |
- ~SyntheticSmoothScrollGesture() override; |
- |
- SyntheticGesture::Result ForwardInputEvents( |
- const base::TimeTicks& timestamp, |
- SyntheticGestureTarget* target) override; |
+ SyntheticSmoothMoveGesture( |
+ SyntheticGestureParams::GestureSourceType gesture_source_type, |
+ gfx::Point start_point, |
+ std::vector<gfx::Vector2d> distances, |
+ int speed_in_pixels_s, |
+ bool prevent_fling); |
+ ~SyntheticSmoothMoveGesture() override; |
- private: |
+ protected: |
enum GestureState { |
SETUP, |
STARTED, |
@@ -43,11 +44,20 @@ class CONTENT_EXPORT SyntheticSmoothScrollGesture : public SyntheticGesture { |
DONE |
}; |
+ GestureState state_; |
+ SyntheticGestureParams::GestureSourceType gesture_source_type_; |
+ int current_move_segment_; |
+ base::TimeTicks current_move_segment_start_time_; |
+ base::TimeTicks current_move_segment_stop_time_; |
+ |
void ForwardTouchInputEvents( |
const base::TimeTicks& timestamp, SyntheticGestureTarget* target); |
- void ForwardMouseInputEvents( |
+ void ForwardMouseWheelInputEvents( |
+ const base::TimeTicks& timestamp, SyntheticGestureTarget* target); |
+ void ForwardMouseClickInputEvents( |
const base::TimeTicks& timestamp, SyntheticGestureTarget* target); |
+ private: |
void ForwardTouchEvent(SyntheticGestureTarget* target, |
const base::TimeTicks& timestamp); |
void ForwardMouseWheelEvent(SyntheticGestureTarget* target, |
@@ -62,30 +72,34 @@ class CONTENT_EXPORT SyntheticSmoothScrollGesture : public SyntheticGesture { |
void ReleaseTouchPoint(SyntheticGestureTarget* target, |
const base::TimeTicks& timestamp); |
+ void PressMousePoint(SyntheticGestureTarget* target, |
+ const base::TimeTicks& timestamp); |
+ void ReleaseMousePoint(SyntheticGestureTarget* target, |
+ const base::TimeTicks& timestamp); |
+ void MoveMousePoint(SyntheticGestureTarget* target, |
+ const gfx::Vector2dF& delta, |
+ const base::TimeTicks& timestamp); |
+ |
void AddTouchSlopToFirstDistance(SyntheticGestureTarget* target); |
- gfx::Vector2dF GetPositionDeltaAtTime(const base::TimeTicks& timestamp) |
- const; |
- void ComputeNextScrollSegment(); |
+ gfx::Vector2dF GetPositionDeltaAtTime(const base::TimeTicks& timestamp) const; |
+ void ComputeNextMoveSegment(); |
base::TimeTicks ClampTimestamp(const base::TimeTicks& timestamp) const; |
- bool FinishedCurrentScrollSegment(const base::TimeTicks& timestamp) const; |
- bool IsLastScrollSegment() const; |
- bool ScrollIsNoOp() const; |
+ bool FinishedCurrentMoveSegment(const base::TimeTicks& timestamp) const; |
+ bool IsLastMoveSegment() const; |
+ bool MoveIsNoOp() const; |
- SyntheticSmoothScrollGestureParams params_; |
// Used for mouse input. |
- gfx::Vector2d current_scroll_segment_total_delta_discrete_; |
+ gfx::Vector2d current_move_segment_total_delta_discrete_; |
// Used for touch input. |
- gfx::Point current_scroll_segment_start_position_; |
+ gfx::Point current_move_segment_start_position_; |
SyntheticWebTouchEvent touch_event_; |
- SyntheticGestureParams::GestureSourceType gesture_source_type_; |
- GestureState state_; |
- int current_scroll_segment_; |
- base::TimeTicks current_scroll_segment_start_time_; |
- base::TimeTicks current_scroll_segment_stop_time_; |
+ std::vector<gfx::Vector2d> move_distances_; |
+ int speed_in_pixels_s_; |
+ bool prevent_fling_; |
- DISALLOW_COPY_AND_ASSIGN(SyntheticSmoothScrollGesture); |
+ DISALLOW_COPY_AND_ASSIGN(SyntheticSmoothMoveGesture); |
}; |
} // namespace content |
-#endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_SMOOTH_SCROLL_GESTURE_H_ |
+#endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_SMOOTH_MOVE_GESTURE_H_ |