| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_PINCH_GESTURE_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_PINCH_GESTURE_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_PINCH_GESTURE_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_PINCH_GESTURE_H_ |
| 7 | 7 |
| 8 #include "base/time/time.h" |
| 8 #include "content/browser/renderer_host/input/synthetic_gesture.h" | 9 #include "content/browser/renderer_host/input/synthetic_gesture.h" |
| 9 #include "content/browser/renderer_host/input/synthetic_gesture_target.h" | 10 #include "content/browser/renderer_host/input/synthetic_gesture_target.h" |
| 10 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
| 11 #include "content/common/input/synthetic_pinch_gesture_params.h" | 12 #include "content/common/input/synthetic_pinch_gesture_params.h" |
| 12 #include "content/common/input/synthetic_web_input_event_builders.h" | 13 #include "content/common/input/synthetic_web_input_event_builders.h" |
| 13 #include "third_party/WebKit/public/web/WebInputEvent.h" | 14 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 14 | 15 |
| 15 namespace content { | 16 namespace content { |
| 16 | 17 |
| 17 class CONTENT_EXPORT SyntheticPinchGesture : public SyntheticGesture { | 18 class CONTENT_EXPORT SyntheticPinchGesture : public SyntheticGesture { |
| 18 public: | 19 public: |
| 19 explicit SyntheticPinchGesture(const SyntheticPinchGestureParams& params); | 20 explicit SyntheticPinchGesture(const SyntheticPinchGestureParams& params); |
| 20 virtual ~SyntheticPinchGesture(); | 21 virtual ~SyntheticPinchGesture(); |
| 21 | 22 |
| 22 virtual SyntheticGesture::Result ForwardInputEvents( | 23 virtual SyntheticGesture::Result ForwardInputEvents( |
| 23 const base::TimeDelta& interval, SyntheticGestureTarget* target) OVERRIDE; | 24 const base::TimeTicks& timestamp, |
| 25 SyntheticGestureTarget* target) OVERRIDE; |
| 24 | 26 |
| 25 private: | 27 private: |
| 26 enum GestureState { | 28 enum GestureState { |
| 27 SETUP, | 29 SETUP, |
| 28 STARTED, | 30 STARTED, |
| 29 MOVING, | 31 MOVING, |
| 30 DONE | 32 DONE |
| 31 }; | 33 }; |
| 32 | 34 |
| 33 void ForwardTouchInputEvents( | 35 void ForwardTouchInputEvents(const base::TimeTicks& timestamp, |
| 34 const base::TimeDelta& interval, SyntheticGestureTarget* target); | 36 SyntheticGestureTarget* target); |
| 35 | 37 |
| 36 void UpdateTouchPoints(base::TimeDelta interval); | 38 void UpdateTouchPoints(const base::TimeTicks& timestamp); |
| 37 void PressTouchPoints(SyntheticGestureTarget* target); | 39 void PressTouchPoints(SyntheticGestureTarget* target, |
| 38 void MoveTouchPoints(SyntheticGestureTarget* target); | 40 const base::TimeTicks& timestamp); |
| 39 void ReleaseTouchPoints(SyntheticGestureTarget* target); | 41 void MoveTouchPoints(SyntheticGestureTarget* target, float delta, |
| 40 void ForwardTouchEvent(SyntheticGestureTarget* target) const; | 42 const base::TimeTicks& timestamp); |
| 43 void ReleaseTouchPoints(SyntheticGestureTarget* target, |
| 44 const base::TimeTicks& timestamp); |
| 45 void ForwardTouchEvent(SyntheticGestureTarget* target, |
| 46 const base::TimeTicks& timestamp); |
| 41 | 47 |
| 42 void SetupCoordinates(SyntheticGestureTarget* target); | 48 void SetupCoordinates(SyntheticGestureTarget* target); |
| 43 float GetDeltaForPointer0(const base::TimeDelta& interval) const; | 49 float GetDeltaForPointer0AndUpdateTimestamp(base::TimeTicks* timestamp) const; |
| 44 float ComputeAbsoluteRemainingDistance() const; | 50 bool HasReachedTarget(float delta) const; |
| 45 bool HasReachedTarget() const; | |
| 46 | 51 |
| 47 SyntheticPinchGestureParams params_; | 52 SyntheticPinchGestureParams params_; |
| 48 float current_y_0_; | 53 float start_y_0_; |
| 49 float current_y_1_; | 54 float start_y_1_; |
| 50 float target_y_0_; | 55 float target_y_0_; |
| 51 float target_y_1_; | 56 float target_y_1_; |
| 52 SyntheticGestureParams::GestureSourceType gesture_source_type_; | 57 SyntheticGestureParams::GestureSourceType gesture_source_type_; |
| 53 GestureState state_; | 58 GestureState state_; |
| 54 SyntheticWebTouchEvent touch_event_; | 59 SyntheticWebTouchEvent touch_event_; |
| 60 base::TimeTicks start_time_; |
| 55 | 61 |
| 62 private: |
| 56 DISALLOW_COPY_AND_ASSIGN(SyntheticPinchGesture); | 63 DISALLOW_COPY_AND_ASSIGN(SyntheticPinchGesture); |
| 57 }; | 64 }; |
| 58 | 65 |
| 59 } // namespace content | 66 } // namespace content |
| 60 | 67 |
| 61 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_PINCH_GESTURE_H_ | 68 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_PINCH_GESTURE_H_ |
| OLD | NEW |