OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_SMOOTH_GESTURE_CONTROLLER_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_SMOOTH_GESTURE_CONTROLLER_H_ |
| 7 |
| 8 #include <map> |
| 9 |
| 10 #include "base/memory/weak_ptr.h" |
| 11 #include "base/time.h" |
| 12 #include "content/common/content_export.h" |
| 13 |
| 14 struct ViewHostMsg_BeginSmoothScroll_Params; |
| 15 |
| 16 namespace content { |
| 17 |
| 18 class RenderWidgetHost; |
| 19 class RenderWidgetHostViewPort; |
| 20 class SmoothScrollGesture; |
| 21 |
| 22 // Controls SmoothScrollGestures, used to inject synthetic events |
| 23 // for performance test harness. |
| 24 class CONTENT_EXPORT SmoothScrollGestureController { |
| 25 public: |
| 26 SmoothScrollGestureController(); |
| 27 ~SmoothScrollGestureController(); |
| 28 |
| 29 // Initiates a synthetic event stream. |
| 30 bool OnBeginSmoothScroll( |
| 31 RenderWidgetHostViewPort* view, |
| 32 const ViewHostMsg_BeginSmoothScroll_Params& params); |
| 33 |
| 34 // Called when an input event is going to be forwarded to the renderer. |
| 35 void OnForwardInputEvent(); |
| 36 |
| 37 // Called when the |rwh| received an ACK for an input event. |
| 38 void OnInputEventACK(RenderWidgetHost* rwh); |
| 39 |
| 40 int SyntheticScrollMessageInterval() const; |
| 41 |
| 42 private: |
| 43 // Called periodically to advance the active scroll gesture after being |
| 44 // initiated by OnBeginSmoothScroll. |
| 45 void TickActiveSmoothScrollGesture(RenderWidgetHost* rwh); |
| 46 |
| 47 base::WeakPtrFactory<SmoothScrollGestureController> weak_factory_; |
| 48 |
| 49 int pending_input_event_count_; |
| 50 |
| 51 scoped_refptr<SmoothScrollGesture> pending_smooth_scroll_gesture_; |
| 52 |
| 53 base::TimeTicks last_smooth_scroll_gesture_tick_time_; |
| 54 bool tick_active_smooth_scroll_gesture_task_posted_; |
| 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(SmoothScrollGestureController); |
| 57 }; |
| 58 |
| 59 } // namespace content |
| 60 |
| 61 #endif // CONTENT_BROWSER_RENDERER_HOST_SMOOTH_GESTURE_CONTROLLER_H_ |
OLD | NEW |