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_GESTURE_CONTROLLER_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_CONTROLLER_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/scoped_vector.h"
10 #include "base/time/time.h"
11 #include "content/browser/renderer_host/input/synthetic_gesture.h"
12 #include "content/common/content_export.h"
13 #include "content/common/input/synthetic_gesture_params.h"
17 class SyntheticGestureTarget
;
19 // Controls a synthetic gesture.
20 // Repeatedly invokes the gesture object's ForwardInputEvent method to send
21 // input events to the platform until the gesture has finished.
22 class CONTENT_EXPORT SyntheticGestureController
{
24 explicit SyntheticGestureController(
25 scoped_ptr
<SyntheticGestureTarget
> gesture_target
);
26 virtual ~SyntheticGestureController();
28 void QueueSyntheticGesture(
29 scoped_ptr
<SyntheticGesture
> synthetic_gesture
);
31 // Forward input events of the currently processed gesture.
32 void Flush(base::TimeTicks timestamp
);
35 void StartGesture(const SyntheticGesture
& gesture
);
36 void StopGesture(const SyntheticGesture
& gesture
,
37 SyntheticGesture::Result result
);
39 scoped_ptr
<SyntheticGestureTarget
> gesture_target_
;
40 ScopedVector
<SyntheticGesture
> pending_gesture_queue_
;
42 DISALLOW_COPY_AND_ASSIGN(SyntheticGestureController
);
45 } // namespace content
47 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_CONTROLLER_H_