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_SYNTHETIC_GESTURE_CONTROLLER_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_SYNTHETIC_GESTURE_CONTROLLER_H_
10 #include "base/memory/weak_ptr.h"
11 #include "base/time/time.h"
12 #include "base/timer/timer.h"
13 #include "content/common/content_export.h"
15 struct ViewHostMsg_BeginPinch_Params;
16 struct ViewHostMsg_BeginSmoothScroll_Params;
20 class RenderWidgetHost;
21 class RenderWidgetHostViewPort;
22 class SyntheticGesture;
24 // Controls SyntheticGestures, used to inject synthetic events
25 // for performance test harness.
26 class CONTENT_EXPORT SyntheticGestureController {
28 SyntheticGestureController();
29 ~SyntheticGestureController();
31 // Initiates a synthetic event stream to simulate a smooth scroll.
32 void BeginSmoothScroll(RenderWidgetHostViewPort* view,
33 const ViewHostMsg_BeginSmoothScroll_Params& params);
35 // Initiates a synthetic event stream to simulate a pinch-to-zoom.
36 void BeginPinch(RenderWidgetHostViewPort* view,
37 const ViewHostMsg_BeginPinch_Params& params);
39 base::TimeDelta GetSyntheticGestureMessageInterval() const;
42 // Called periodically to advance the active scroll gesture after being
43 // initiated by OnBeginSmoothScroll.
46 base::RepeatingTimer<SyntheticGestureController> timer_;
48 RenderWidgetHost* rwh_;
50 scoped_refptr<SyntheticGesture> pending_synthetic_gesture_;
52 DISALLOW_COPY_AND_ASSIGN(SyntheticGestureController);
55 } // namespace content
57 #endif // CONTENT_BROWSER_RENDERER_HOST_SYNTHETIC_GESTURE_CONTROLLER_H_