Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Side by Side Diff: content/browser/renderer_host/input/mouse_wheel_event_queue.cc

Issue 2047093002: Remove enable/disable wheel gestures setting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@can_scroll_remove
Patch Set: Remove unused, uninitialized variable on mac causing occasional failure Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "content/browser/renderer_host/input/mouse_wheel_event_queue.h" 5 #include "content/browser/renderer_host/input/mouse_wheel_event_queue.h"
6 6
7 #include "base/metrics/histogram_macros.h" 7 #include "base/metrics/histogram_macros.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 10
(...skipping 15 matching lines...) Expand all
26 26
27 ~QueuedWebMouseWheelEvent() { 27 ~QueuedWebMouseWheelEvent() {
28 TRACE_EVENT_ASYNC_END0("input", "MouseWheelEventQueue::QueueEvent", this); 28 TRACE_EVENT_ASYNC_END0("input", "MouseWheelEventQueue::QueueEvent", this);
29 } 29 }
30 30
31 private: 31 private:
32 DISALLOW_COPY_AND_ASSIGN(QueuedWebMouseWheelEvent); 32 DISALLOW_COPY_AND_ASSIGN(QueuedWebMouseWheelEvent);
33 }; 33 };
34 34
35 MouseWheelEventQueue::MouseWheelEventQueue(MouseWheelEventQueueClient* client, 35 MouseWheelEventQueue::MouseWheelEventQueue(MouseWheelEventQueueClient* client,
36 bool send_gestures,
37 int64_t scroll_transaction_ms) 36 int64_t scroll_transaction_ms)
38 : client_(client), 37 : client_(client),
39 needs_scroll_begin_(true), 38 needs_scroll_begin_(true),
40 needs_scroll_end_(false), 39 needs_scroll_end_(false),
41 send_gestures_(send_gestures),
42 scroll_transaction_ms_(scroll_transaction_ms), 40 scroll_transaction_ms_(scroll_transaction_ms),
43 scrolling_device_(blink::WebGestureDeviceUninitialized) { 41 scrolling_device_(blink::WebGestureDeviceUninitialized) {
44 DCHECK(client); 42 DCHECK(client);
45 } 43 }
46 44
47 MouseWheelEventQueue::~MouseWheelEventQueue() { 45 MouseWheelEventQueue::~MouseWheelEventQueue() {
48 if (!wheel_queue_.empty()) 46 if (!wheel_queue_.empty())
49 STLDeleteElements(&wheel_queue_); 47 STLDeleteElements(&wheel_queue_);
50 } 48 }
51 49
(...skipping 22 matching lines...) Expand all
74 InputEventAckState ack_result, 72 InputEventAckState ack_result,
75 const LatencyInfo& latency_info) { 73 const LatencyInfo& latency_info) {
76 TRACE_EVENT0("input", "MouseWheelEventQueue::ProcessMouseWheelAck"); 74 TRACE_EVENT0("input", "MouseWheelEventQueue::ProcessMouseWheelAck");
77 if (!event_sent_for_gesture_ack_) 75 if (!event_sent_for_gesture_ack_)
78 return; 76 return;
79 77
80 event_sent_for_gesture_ack_->latency.AddNewLatencyFrom(latency_info); 78 event_sent_for_gesture_ack_->latency.AddNewLatencyFrom(latency_info);
81 client_->OnMouseWheelEventAck(*event_sent_for_gesture_ack_, ack_result); 79 client_->OnMouseWheelEventAck(*event_sent_for_gesture_ack_, ack_result);
82 80
83 // If event wasn't consumed then generate a gesture scroll for it. 81 // If event wasn't consumed then generate a gesture scroll for it.
84 if (send_gestures_ && ack_result != INPUT_EVENT_ACK_STATE_CONSUMED && 82 if (ack_result != INPUT_EVENT_ACK_STATE_CONSUMED &&
85 event_sent_for_gesture_ack_->event.canScroll && 83 event_sent_for_gesture_ack_->event.canScroll &&
86 event_sent_for_gesture_ack_->event.resendingPluginId == -1 && 84 event_sent_for_gesture_ack_->event.resendingPluginId == -1 &&
87 (scrolling_device_ == blink::WebGestureDeviceUninitialized || 85 (scrolling_device_ == blink::WebGestureDeviceUninitialized ||
88 scrolling_device_ == blink::WebGestureDeviceTouchpad)) { 86 scrolling_device_ == blink::WebGestureDeviceTouchpad)) {
89 WebGestureEvent scroll_update; 87 WebGestureEvent scroll_update;
90 scroll_update.timeStampSeconds = 88 scroll_update.timeStampSeconds =
91 event_sent_for_gesture_ack_->event.timeStampSeconds; 89 event_sent_for_gesture_ack_->event.timeStampSeconds;
92 90
93 scroll_update.x = event_sent_for_gesture_ack_->event.x; 91 scroll_update.x = event_sent_for_gesture_ack_->event.x;
94 scroll_update.y = event_sent_for_gesture_ack_->event.y; 92 scroll_update.y = event_sent_for_gesture_ack_->event.y;
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 scroll_begin.data.scrollBegin.targetViewport = false; 283 scroll_begin.data.scrollBegin.targetViewport = false;
286 scroll_begin.data.scrollBegin.deltaHintUnits = 284 scroll_begin.data.scrollBegin.deltaHintUnits =
287 gesture_update.data.scrollUpdate.deltaUnits; 285 gesture_update.data.scrollUpdate.deltaUnits;
288 286
289 needs_scroll_begin_ = false; 287 needs_scroll_begin_ = false;
290 needs_scroll_end_ = true; 288 needs_scroll_end_ = true;
291 client_->ForwardGestureEventWithLatencyInfo(scroll_begin, ui::LatencyInfo()); 289 client_->ForwardGestureEventWithLatencyInfo(scroll_begin, ui::LatencyInfo());
292 } 290 }
293 291
294 } // namespace content 292 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698