OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_MOUSE_WHEEL_EVENT_QUEUE_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_MOUSE_WHEEL_EVENT_QUEUE_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_MOUSE_WHEEL_EVENT_QUEUE_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_MOUSE_WHEEL_EVENT_QUEUE_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 | 9 |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 // A queue for throttling and coalescing mouse wheel events. | 41 // A queue for throttling and coalescing mouse wheel events. |
42 class CONTENT_EXPORT MouseWheelEventQueue { | 42 class CONTENT_EXPORT MouseWheelEventQueue { |
43 public: | 43 public: |
44 // The |client| must outlive the MouseWheelEventQueue. |send_gestures| | 44 // The |client| must outlive the MouseWheelEventQueue. |send_gestures| |
45 // indicates whether mouse wheel events should generate | 45 // indicates whether mouse wheel events should generate |
46 // Scroll[Begin|Update|End] on unhandled acknowledge events. | 46 // Scroll[Begin|Update|End] on unhandled acknowledge events. |
47 // |scroll_transaction_ms| is the duration in which the | 47 // |scroll_transaction_ms| is the duration in which the |
48 // ScrollEnd should be sent after a ScrollUpdate. | 48 // ScrollEnd should be sent after a ScrollUpdate. |
49 MouseWheelEventQueue(MouseWheelEventQueueClient* client, | 49 MouseWheelEventQueue(MouseWheelEventQueueClient* client, |
50 bool send_gestures, | |
51 int64_t scroll_transaction_ms); | 50 int64_t scroll_transaction_ms); |
52 | 51 |
53 ~MouseWheelEventQueue(); | 52 ~MouseWheelEventQueue(); |
54 | 53 |
55 // Adds an event to the queue. The event may be coalesced with previously | 54 // Adds an event to the queue. The event may be coalesced with previously |
56 // queued events (e.g. consecutive mouse-wheel events can be coalesced into a | 55 // queued events (e.g. consecutive mouse-wheel events can be coalesced into a |
57 // single mouse-wheel event). The event may also be immediately forwarded to | 56 // single mouse-wheel event). The event may also be immediately forwarded to |
58 // the renderer (e.g. when there are no other queued mouse-wheel event). | 57 // the renderer (e.g. when there are no other queued mouse-wheel event). |
59 void QueueEvent(const MouseWheelEventWithLatencyInfo& event); | 58 void QueueEvent(const MouseWheelEventWithLatencyInfo& event); |
60 | 59 |
(...skipping 30 matching lines...) Expand all Loading... |
91 WheelEventQueue wheel_queue_; | 90 WheelEventQueue wheel_queue_; |
92 std::unique_ptr<QueuedWebMouseWheelEvent> event_sent_for_gesture_ack_; | 91 std::unique_ptr<QueuedWebMouseWheelEvent> event_sent_for_gesture_ack_; |
93 | 92 |
94 // True if a non-synthetic GSB needs to be sent before a GSU is sent. | 93 // True if a non-synthetic GSB needs to be sent before a GSU is sent. |
95 bool needs_scroll_begin_; | 94 bool needs_scroll_begin_; |
96 | 95 |
97 // True if a non-synthetic GSE needs to be sent because a non-synthetic | 96 // True if a non-synthetic GSE needs to be sent because a non-synthetic |
98 // GSB has been sent in the past. | 97 // GSB has been sent in the past. |
99 bool needs_scroll_end_; | 98 bool needs_scroll_end_; |
100 | 99 |
101 bool send_gestures_; | |
102 int64_t scroll_transaction_ms_; | 100 int64_t scroll_transaction_ms_; |
103 blink::WebGestureDevice scrolling_device_; | 101 blink::WebGestureDevice scrolling_device_; |
104 | 102 |
105 DISALLOW_COPY_AND_ASSIGN(MouseWheelEventQueue); | 103 DISALLOW_COPY_AND_ASSIGN(MouseWheelEventQueue); |
106 }; | 104 }; |
107 | 105 |
108 } // namespace content | 106 } // namespace content |
109 | 107 |
110 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_MOUSE_WHEEL_EVENT_QUEUE_H_ | 108 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_MOUSE_WHEEL_EVENT_QUEUE_H_ |
OLD | NEW |