| 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 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| 11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 12 #include "base/timer/timer.h" | |
| 13 #include "content/browser/renderer_host/event_with_latency_info.h" | 12 #include "content/browser/renderer_host/event_with_latency_info.h" |
| 14 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 15 #include "content/common/input/input_event_ack_state.h" | 14 #include "content/common/input/input_event_ack_state.h" |
| 16 #include "third_party/WebKit/public/platform/WebInputEvent.h" | 15 #include "third_party/WebKit/public/platform/WebInputEvent.h" |
| 17 | 16 |
| 18 namespace content { | 17 namespace content { |
| 19 | 18 |
| 20 // The duration in which a ScrollEnd will be sent after the last | |
| 21 // ScrollUpdate was sent for wheel based gesture scrolls. | |
| 22 // This value is used only if |enable_scroll_latching_| is true. | |
| 23 const int64_t kDefaultWheelScrollLatchingTransactionMs = 100; | |
| 24 | |
| 25 class QueuedWebMouseWheelEvent; | 19 class QueuedWebMouseWheelEvent; |
| 26 | 20 |
| 27 // Interface with which MouseWheelEventQueue can forward mouse wheel events, | 21 // Interface with which MouseWheelEventQueue can forward mouse wheel events, |
| 28 // and dispatch mouse wheel event responses. | 22 // and dispatch mouse wheel event responses. |
| 29 class CONTENT_EXPORT MouseWheelEventQueueClient { | 23 class CONTENT_EXPORT MouseWheelEventQueueClient { |
| 30 public: | 24 public: |
| 31 virtual ~MouseWheelEventQueueClient() {} | 25 virtual ~MouseWheelEventQueueClient() {} |
| 32 | 26 |
| 33 virtual void SendMouseWheelEventImmediately( | 27 virtual void SendMouseWheelEventImmediately( |
| 34 const MouseWheelEventWithLatencyInfo& event) = 0; | 28 const MouseWheelEventWithLatencyInfo& event) = 0; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 return event_sent_for_gesture_ack_ != nullptr; | 72 return event_sent_for_gesture_ack_ != nullptr; |
| 79 } | 73 } |
| 80 | 74 |
| 81 private: | 75 private: |
| 82 void TryForwardNextEventToRenderer(); | 76 void TryForwardNextEventToRenderer(); |
| 83 void SendScrollEnd(blink::WebGestureEvent update_event, bool synthetic); | 77 void SendScrollEnd(blink::WebGestureEvent update_event, bool synthetic); |
| 84 void SendScrollBegin(const blink::WebGestureEvent& gesture_update, | 78 void SendScrollBegin(const blink::WebGestureEvent& gesture_update, |
| 85 bool synthetic); | 79 bool synthetic); |
| 86 | 80 |
| 87 MouseWheelEventQueueClient* client_; | 81 MouseWheelEventQueueClient* client_; |
| 88 base::OneShotTimer scroll_end_timer_; | |
| 89 | 82 |
| 90 std::deque<std::unique_ptr<QueuedWebMouseWheelEvent>> wheel_queue_; | 83 std::deque<std::unique_ptr<QueuedWebMouseWheelEvent>> wheel_queue_; |
| 91 std::unique_ptr<QueuedWebMouseWheelEvent> event_sent_for_gesture_ack_; | 84 std::unique_ptr<QueuedWebMouseWheelEvent> event_sent_for_gesture_ack_; |
| 92 | 85 |
| 93 // True if a non-synthetic GSB needs to be sent before a GSU is sent. | 86 // True if a non-synthetic GSB needs to be sent before a GSU is sent. |
| 94 bool needs_scroll_begin_; | 87 bool needs_scroll_begin_; |
| 95 | 88 |
| 96 // True if a non-synthetic GSE needs to be sent because a non-synthetic | 89 // True if a non-synthetic GSE needs to be sent because a non-synthetic |
| 97 // GSB has been sent in the past. | 90 // GSB has been sent in the past. |
| 98 bool needs_scroll_end_; | 91 bool needs_scroll_end_; |
| 99 | 92 |
| 100 // True if the touchpad and wheel scroll latching is enabled. | 93 // True if the touchpad and wheel scroll latching is enabled. |
| 101 bool enable_scroll_latching_; | 94 bool enable_scroll_latching_; |
| 102 | 95 |
| 103 int64_t scroll_transaction_ms_; | |
| 104 blink::WebGestureDevice scrolling_device_; | 96 blink::WebGestureDevice scrolling_device_; |
| 105 | 97 |
| 106 DISALLOW_COPY_AND_ASSIGN(MouseWheelEventQueue); | 98 DISALLOW_COPY_AND_ASSIGN(MouseWheelEventQueue); |
| 107 }; | 99 }; |
| 108 | 100 |
| 109 } // namespace content | 101 } // namespace content |
| 110 | 102 |
| 111 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_MOUSE_WHEEL_EVENT_QUEUE_H_ | 103 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_MOUSE_WHEEL_EVENT_QUEUE_H_ |
| OLD | NEW |