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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_PINCH_GESTURE_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_PINCH_GESTURE_H_
8 #include "base/time/time.h"
9 #include "content/browser/renderer_host/input/synthetic_gesture.h"
10 #include "content/browser/renderer_host/input/synthetic_gesture_target.h"
11 #include "content/common/content_export.h"
12 #include "content/common/input/synthetic_pinch_gesture_params.h"
13 #include "content/common/input/synthetic_web_input_event_builders.h"
14 #include "third_party/WebKit/public/web/WebInputEvent.h"
18 class CONTENT_EXPORT SyntheticPinchGesture
: public SyntheticGesture
{
20 explicit SyntheticPinchGesture(const SyntheticPinchGestureParams
& params
);
21 virtual ~SyntheticPinchGesture();
23 virtual SyntheticGesture::Result
ForwardInputEvents(
24 const base::TimeTicks
& timestamp
,
25 SyntheticGestureTarget
* target
) OVERRIDE
;
35 void ForwardTouchInputEvents(const base::TimeTicks
& timestamp
,
36 SyntheticGestureTarget
* target
);
38 void UpdateTouchPoints(const base::TimeTicks
& timestamp
);
39 void PressTouchPoints(SyntheticGestureTarget
* target
,
40 const base::TimeTicks
& timestamp
);
41 void MoveTouchPoints(SyntheticGestureTarget
* target
, float delta
,
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
);
48 void SetupCoordinatesAndStopTime(SyntheticGestureTarget
* target
);
49 float GetDeltaForPointer0AtTime(const base::TimeTicks
& timestamp
) const;
50 base::TimeTicks
ClampTimestamp(const base::TimeTicks
& timestamp
) const;
51 bool HasReachedTarget(const base::TimeTicks
& timestamp
) const;
53 SyntheticPinchGestureParams params_
;
56 SyntheticGestureParams::GestureSourceType gesture_source_type_
;
58 SyntheticWebTouchEvent touch_event_
;
59 base::TimeTicks start_time_
;
60 base::TimeTicks stop_time_
;
63 DISALLOW_COPY_AND_ASSIGN(SyntheticPinchGesture
);
66 } // namespace content
68 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_PINCH_GESTURE_H_