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 CONTENT_RENDERER_INPUT_INPUT_HANDLER_PROXY_H_ | 5 #ifndef CONTENT_RENDERER_INPUT_INPUT_HANDLER_PROXY_H_ |
6 #define CONTENT_RENDERER_INPUT_INPUT_HANDLER_PROXY_H_ | 6 #define CONTENT_RENDERER_INPUT_INPUT_HANDLER_PROXY_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 59 |
60 private: | 60 private: |
61 EventDisposition HandleGestureFling(const blink::WebGestureEvent& event); | 61 EventDisposition HandleGestureFling(const blink::WebGestureEvent& event); |
62 | 62 |
63 // Returns true if the event should be suppressed due to to an active, | 63 // Returns true if the event should be suppressed due to to an active, |
64 // boost-enabled fling, in which case further processing should cease. | 64 // boost-enabled fling, in which case further processing should cease. |
65 bool FilterInputEventForFlingBoosting(const blink::WebInputEvent& event); | 65 bool FilterInputEventForFlingBoosting(const blink::WebInputEvent& event); |
66 | 66 |
67 // Schedule a time in the future after which a boost-enabled fling will | 67 // Schedule a time in the future after which a boost-enabled fling will |
68 // terminate without further momentum from the user (see |Animate()|). | 68 // terminate without further momentum from the user (see |Animate()|). |
69 void FlingBoostExtend(const blink::WebGestureEvent& event); | 69 void ExtendBoostedFlingTimeout(const blink::WebGestureEvent& event); |
70 | |
71 // Cancel the current fling and insert a GestureScrollBegin if necessary. | |
72 void FlingBoostCancelAndResumeScrollingIfNecessary(); | |
73 | 70 |
74 // Returns true if we scrolled by the increment. | 71 // Returns true if we scrolled by the increment. |
75 bool TouchpadFlingScroll(const blink::WebFloatSize& increment); | 72 bool TouchpadFlingScroll(const blink::WebFloatSize& increment); |
76 | 73 |
| 74 // Returns true if we actually had an active fling to cancel, also notifying |
| 75 // the client that the fling has ended. Note that if a boosted fling is active |
| 76 // and suppressing an active scroll sequence, a synthetic GestureScrollBegin |
| 77 // will be injected to resume scrolling. |
| 78 bool CancelCurrentFling(); |
| 79 |
77 // Returns true if we actually had an active fling to cancel. | 80 // Returns true if we actually had an active fling to cancel. |
78 bool CancelCurrentFling(bool send_fling_stopped_notification); | 81 bool CancelCurrentFlingWithoutNotifyingClient(); |
79 | 82 |
80 scoped_ptr<blink::WebGestureCurve> fling_curve_; | 83 scoped_ptr<blink::WebGestureCurve> fling_curve_; |
81 // Parameters for the active fling animation, stored in case we need to | 84 // Parameters for the active fling animation, stored in case we need to |
82 // transfer it out later. | 85 // transfer it out later. |
83 blink::WebActiveWheelFlingParameters fling_parameters_; | 86 blink::WebActiveWheelFlingParameters fling_parameters_; |
84 | 87 |
85 InputHandlerProxyClient* client_; | 88 InputHandlerProxyClient* client_; |
86 cc::InputHandler* input_handler_; | 89 cc::InputHandler* input_handler_; |
87 | 90 |
88 // Time at which an active fling should expire due to a deferred cancellation | 91 // Time at which an active fling should expire due to a deferred cancellation |
89 // event. A call to |Animate()| after this time will end the fling. | 92 // event. A call to |Animate()| after this time will end the fling. |
90 double deferred_fling_cancel_time_seconds_; | 93 double deferred_fling_cancel_time_seconds_; |
91 | 94 |
92 // The last event that extended the lifetime of the boosted fling. If the | 95 // The last event that extended the lifetime of the boosted fling. If the |
93 // event was a scroll gesture, a GestureScrollBegin will be inserted if the | 96 // event was a scroll gesture, a GestureScrollBegin will be inserted if the |
94 // fling terminates (via |FlingBoostCancelAndResumeScrollingIfNecessary()|). | 97 // fling terminates (via |CancelCurrentFling()|). |
95 blink::WebGestureEvent last_fling_boost_event_; | 98 blink::WebGestureEvent last_fling_boost_event_; |
96 | 99 |
97 #ifndef NDEBUG | 100 #ifndef NDEBUG |
98 bool expect_scroll_update_end_; | 101 bool expect_scroll_update_end_; |
99 #endif | 102 #endif |
100 bool gesture_scroll_on_impl_thread_; | 103 bool gesture_scroll_on_impl_thread_; |
101 bool gesture_pinch_on_impl_thread_; | 104 bool gesture_pinch_on_impl_thread_; |
102 // This is always false when there are no flings on the main thread, but | 105 // This is always false when there are no flings on the main thread, but |
103 // conservative in the sense that we might not be actually flinging when it is | 106 // conservative in the sense that we might not be actually flinging when it is |
104 // true. | 107 // true. |
(...skipping 12 matching lines...) Expand all Loading... |
117 gfx::Vector2dF current_fling_velocity_; | 120 gfx::Vector2dF current_fling_velocity_; |
118 | 121 |
119 bool smooth_scroll_enabled_; | 122 bool smooth_scroll_enabled_; |
120 | 123 |
121 DISALLOW_COPY_AND_ASSIGN(InputHandlerProxy); | 124 DISALLOW_COPY_AND_ASSIGN(InputHandlerProxy); |
122 }; | 125 }; |
123 | 126 |
124 } // namespace content | 127 } // namespace content |
125 | 128 |
126 #endif // CONTENT_RENDERER_INPUT_INPUT_HANDLER_PROXY_H_ | 129 #endif // CONTENT_RENDERER_INPUT_INPUT_HANDLER_PROXY_H_ |
OLD | NEW |