OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_SYNTHETIC_GESTURE_CONTROLLER_H_ | |
6 #define CONTENT_BROWSER_RENDERER_HOST_SYNTHETIC_GESTURE_CONTROLLER_H_ | |
7 | |
8 #include <map> | |
9 | |
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" | |
14 | |
15 struct ViewHostMsg_BeginPinch_Params; | |
16 struct ViewHostMsg_BeginSmoothScroll_Params; | |
17 | |
18 namespace content { | |
19 | |
20 class RenderWidgetHost; | |
21 class RenderWidgetHostViewPort; | |
22 class SyntheticGesture; | |
23 | |
24 // Controls SyntheticGestures, used to inject synthetic events | |
25 // for performance test harness. | |
26 class CONTENT_EXPORT SyntheticGestureController { | |
27 public: | |
28 SyntheticGestureController(); | |
29 ~SyntheticGestureController(); | |
30 | |
31 // Initiates a synthetic event stream to simulate a smooth scroll. | |
32 void BeginSmoothScroll(RenderWidgetHostViewPort* view, | |
33 const ViewHostMsg_BeginSmoothScroll_Params& params); | |
34 | |
35 // Initiates a synthetic event stream to simulate a pinch-to-zoom. | |
36 void BeginPinch(RenderWidgetHostViewPort* view, | |
37 const ViewHostMsg_BeginPinch_Params& params); | |
38 | |
39 base::TimeDelta GetSyntheticGestureMessageInterval() const; | |
40 | |
41 private: | |
42 // Called periodically to advance the active scroll gesture after being | |
43 // initiated by OnBeginSmoothScroll. | |
44 void OnTimer(); | |
45 | |
46 base::RepeatingTimer<SyntheticGestureController> timer_; | |
47 | |
48 RenderWidgetHost* rwh_; | |
49 | |
50 scoped_refptr<SyntheticGesture> pending_synthetic_gesture_; | |
51 | |
52 DISALLOW_COPY_AND_ASSIGN(SyntheticGestureController); | |
53 }; | |
54 | |
55 } // namespace content | |
56 | |
57 #endif // CONTENT_BROWSER_RENDERER_HOST_SYNTHETIC_GESTURE_CONTROLLER_H_ | |
OLD | NEW |