OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 UI_EVENTS_BLINK_INPUT_HANDLER_PROXY_H_ | 5 #ifndef UI_EVENTS_BLINK_INPUT_HANDLER_PROXY_H_ |
6 #define UI_EVENTS_BLINK_INPUT_HANDLER_PROXY_H_ | 6 #define UI_EVENTS_BLINK_INPUT_HANDLER_PROXY_H_ |
7 | 7 |
8 #include "base/containers/hash_tables.h" | 8 #include "base/containers/hash_tables.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 | 39 |
40 InputHandlerProxy(cc::InputHandler* input_handler, | 40 InputHandlerProxy(cc::InputHandler* input_handler, |
41 InputHandlerProxyClient* client); | 41 InputHandlerProxyClient* client); |
42 ~InputHandlerProxy() override; | 42 ~InputHandlerProxy() override; |
43 | 43 |
44 InputScrollElasticityController* scroll_elasticity_controller() { | 44 InputScrollElasticityController* scroll_elasticity_controller() { |
45 return scroll_elasticity_controller_.get(); | 45 return scroll_elasticity_controller_.get(); |
46 } | 46 } |
47 | 47 |
48 void set_smooth_scroll_enabled(bool value) { smooth_scroll_enabled_ = value; } | 48 void set_smooth_scroll_enabled(bool value) { smooth_scroll_enabled_ = value; } |
| 49 void set_use_gesture_events_for_mouse_wheel(bool value) { |
| 50 use_gesture_events_for_mouse_wheel_ = value; |
| 51 } |
49 | 52 |
50 enum EventDisposition { | 53 enum EventDisposition { |
51 DID_HANDLE, | 54 DID_HANDLE, |
52 DID_NOT_HANDLE, | 55 DID_NOT_HANDLE, |
| 56 DID_HANDLE_NON_BLOCKING, |
53 DROP_EVENT | 57 DROP_EVENT |
54 }; | 58 }; |
55 EventDisposition HandleInputEventWithLatencyInfo( | 59 EventDisposition HandleInputEventWithLatencyInfo( |
56 const blink::WebInputEvent& event, | 60 const blink::WebInputEvent& event, |
57 ui::LatencyInfo* latency_info); | 61 ui::LatencyInfo* latency_info); |
58 EventDisposition HandleInputEvent(const blink::WebInputEvent& event); | 62 EventDisposition HandleInputEvent(const blink::WebInputEvent& event); |
59 | 63 |
60 // cc::InputHandlerClient implementation. | 64 // cc::InputHandlerClient implementation. |
61 void WillShutdown() override; | 65 void WillShutdown() override; |
62 void Animate(base::TimeTicks time) override; | 66 void Animate(base::TimeTicks time) override; |
(...skipping 21 matching lines...) Expand all Loading... |
84 bool gesture_scroll_on_impl_thread_for_testing() const { | 88 bool gesture_scroll_on_impl_thread_for_testing() const { |
85 return gesture_scroll_on_impl_thread_; | 89 return gesture_scroll_on_impl_thread_; |
86 } | 90 } |
87 | 91 |
88 private: | 92 private: |
89 friend class test::InputHandlerProxyTest; | 93 friend class test::InputHandlerProxyTest; |
90 | 94 |
91 // Helper functions for handling more complicated input events. | 95 // Helper functions for handling more complicated input events. |
92 EventDisposition HandleMouseWheel( | 96 EventDisposition HandleMouseWheel( |
93 const blink::WebMouseWheelEvent& event); | 97 const blink::WebMouseWheelEvent& event); |
| 98 EventDisposition ScrollByMouseWheel(const blink::WebMouseWheelEvent& event); |
94 EventDisposition HandleGestureScrollBegin( | 99 EventDisposition HandleGestureScrollBegin( |
95 const blink::WebGestureEvent& event); | 100 const blink::WebGestureEvent& event); |
96 EventDisposition HandleGestureScrollUpdate( | 101 EventDisposition HandleGestureScrollUpdate( |
97 const blink::WebGestureEvent& event); | 102 const blink::WebGestureEvent& event); |
98 EventDisposition HandleGestureScrollEnd( | 103 EventDisposition HandleGestureScrollEnd( |
99 const blink::WebGestureEvent& event); | 104 const blink::WebGestureEvent& event); |
100 EventDisposition HandleGestureFlingStart( | 105 EventDisposition HandleGestureFlingStart( |
101 const blink::WebGestureEvent& event); | 106 const blink::WebGestureEvent& event); |
102 EventDisposition HandleTouchStart( | 107 EventDisposition HandleTouchStart(const blink::WebTouchEvent& event); |
103 const blink::WebTouchEvent& event); | 108 EventDisposition HandleTouchMove(const blink::WebTouchEvent& event); |
| 109 EventDisposition HandleTouchEnd(const blink::WebTouchEvent& event); |
104 | 110 |
105 // Returns true if the event should be suppressed due to to an active, | 111 // Returns true if the event should be suppressed due to to an active, |
106 // boost-enabled fling, in which case further processing should cease. | 112 // boost-enabled fling, in which case further processing should cease. |
107 bool FilterInputEventForFlingBoosting(const blink::WebInputEvent& event); | 113 bool FilterInputEventForFlingBoosting(const blink::WebInputEvent& event); |
108 | 114 |
109 // Schedule a time in the future after which a boost-enabled fling will | 115 // Schedule a time in the future after which a boost-enabled fling will |
110 // terminate without further momentum from the user (see |Animate()|). | 116 // terminate without further momentum from the user (see |Animate()|). |
111 void ExtendBoostedFlingTimeout(const blink::WebGestureEvent& event); | 117 void ExtendBoostedFlingTimeout(const blink::WebGestureEvent& event); |
112 | 118 |
113 // Returns true if we scrolled by the increment. | 119 // Returns true if we scrolled by the increment. |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 // determining if the fling start time should be re-initialized. | 183 // determining if the fling start time should be re-initialized. |
178 bool has_fling_animation_started_; | 184 bool has_fling_animation_started_; |
179 | 185 |
180 // Non-zero only within the scope of |scrollBy|. | 186 // Non-zero only within the scope of |scrollBy|. |
181 gfx::Vector2dF current_fling_velocity_; | 187 gfx::Vector2dF current_fling_velocity_; |
182 | 188 |
183 // Used to animate rubber-band over-scroll effect on Mac. | 189 // Used to animate rubber-band over-scroll effect on Mac. |
184 scoped_ptr<InputScrollElasticityController> scroll_elasticity_controller_; | 190 scoped_ptr<InputScrollElasticityController> scroll_elasticity_controller_; |
185 | 191 |
186 bool smooth_scroll_enabled_; | 192 bool smooth_scroll_enabled_; |
| 193 bool uma_latency_reporting_enabled_; |
| 194 bool use_gesture_events_for_mouse_wheel_; |
187 | 195 |
188 bool uma_latency_reporting_enabled_; | 196 // The merged result of the last touch start with previous touch starts. |
| 197 // This value will get returned for subsequent TouchMove events to allow |
| 198 // passive events not to block scrolling. |
| 199 int32_t touch_start_result_; |
189 | 200 |
190 base::TimeTicks last_fling_animate_time_; | 201 base::TimeTicks last_fling_animate_time_; |
191 | 202 |
192 DISALLOW_COPY_AND_ASSIGN(InputHandlerProxy); | 203 DISALLOW_COPY_AND_ASSIGN(InputHandlerProxy); |
193 }; | 204 }; |
194 | 205 |
195 } // namespace ui | 206 } // namespace ui |
196 | 207 |
197 #endif // UI_EVENTS_BLINK_INPUT_HANDLER_PROXY_H_ | 208 #endif // UI_EVENTS_BLINK_INPUT_HANDLER_PROXY_H_ |
OLD | NEW |