1 // Copyright (c) 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_SMOOTH_SCROLL_GESTURE_CONTROLLER_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_SMOOTH_SCROLL_GESTURE_CONTROLLER_H_
10 #include "base/memory/weak_ptr.h"
11 #include "base/time.h"
12 #include "base/timer.h"
13 #include "content/common/content_export.h"
15 struct ViewHostMsg_BeginSmoothScroll_Params
;
19 class RenderWidgetHost
;
20 class RenderWidgetHostViewPort
;
21 class SmoothScrollGesture
;
23 // Controls SmoothScrollGestures, used to inject synthetic events
24 // for performance test harness.
25 class CONTENT_EXPORT SmoothScrollGestureController
{
27 SmoothScrollGestureController();
28 ~SmoothScrollGestureController();
30 // Initiates a synthetic event stream.
31 void BeginSmoothScroll(RenderWidgetHostViewPort
* view
,
32 const ViewHostMsg_BeginSmoothScroll_Params
& params
);
34 base::TimeDelta
GetSyntheticScrollMessageInterval() const;
37 // Called periodically to advance the active scroll gesture after being
38 // initiated by OnBeginSmoothScroll.
41 base::RepeatingTimer
<SmoothScrollGestureController
> timer_
;
43 RenderWidgetHost
* rwh_
;
45 scoped_refptr
<SmoothScrollGesture
> pending_smooth_scroll_gesture_
;
47 DISALLOW_COPY_AND_ASSIGN(SmoothScrollGestureController
);
50 } // namespace content
52 #endif // CONTENT_BROWSER_RENDERER_HOST_SMOOTH_SCROLL_GESTURE_CONTROLLER_H_