OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_OVERSCROLL_CONTROLLER_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_OVERSCROLL_CONTROLLER_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_OVERSCROLL_CONTROLLER_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_OVERSCROLL_CONTROLLER_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "third_party/WebKit/public/web/WebInputEvent.h" | 10 #include "third_party/WebKit/public/web/WebInputEvent.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 bool DispatchEventResetsState(const blink::WebInputEvent& event) const; | 85 bool DispatchEventResetsState(const blink::WebInputEvent& event) const; |
86 | 86 |
87 // Processes an event to update the internal state for overscroll. Returns | 87 // Processes an event to update the internal state for overscroll. Returns |
88 // true if the state is updated, false otherwise. | 88 // true if the state is updated, false otherwise. |
89 bool ProcessEventForOverscroll(const blink::WebInputEvent& event); | 89 bool ProcessEventForOverscroll(const blink::WebInputEvent& event); |
90 | 90 |
91 // Processes horizontal overscroll. This can update both the overscroll mode | 91 // Processes horizontal overscroll. This can update both the overscroll mode |
92 // and the over scroll amount (i.e. |overscroll_mode_|, |overscroll_delta_x_| | 92 // and the over scroll amount (i.e. |overscroll_mode_|, |overscroll_delta_x_| |
93 // and |overscroll_delta_y_|). Returns true if overscroll was handled by the | 93 // and |overscroll_delta_y_|). Returns true if overscroll was handled by the |
94 // delegate. | 94 // delegate. |
95 bool ProcessOverscroll(float delta_x, | 95 bool ProcessOverscroll(float delta_x, float delta_y, bool is_touchpad); |
96 float delta_y, | |
97 blink::WebInputEvent::Type event_type); | |
98 | 96 |
99 // Completes the desired action from the current gesture. | 97 // Completes the desired action from the current gesture. |
100 void CompleteAction(); | 98 void CompleteAction(); |
101 | 99 |
102 // Sets the overscroll mode (and triggers callback in the delegate when | 100 // Sets the overscroll mode (and triggers callback in the delegate when |
103 // appropriate). | 101 // appropriate). |
104 void SetOverscrollMode(OverscrollMode new_mode); | 102 void SetOverscrollMode(OverscrollMode new_mode); |
105 | 103 |
106 // The current state of overscroll gesture. | 104 // The current state of overscroll gesture. |
107 OverscrollMode overscroll_mode_; | 105 OverscrollMode overscroll_mode_; |
108 | 106 |
109 // Used to keep track of the scrolling state. | 107 // Used to keep track of the scrolling state. |
110 // If scrolling starts, and some scroll events are consumed at the beginning | 108 // If scrolling starts, and some scroll events are consumed at the beginning |
111 // of the scroll (i.e. some content on the web-page was scrolled), then do not | 109 // of the scroll (i.e. some content on the web-page was scrolled), then do not |
112 // process any of the subsequent scroll events for generating overscroll | 110 // process any of the subsequent scroll events for generating overscroll |
113 // gestures. | 111 // gestures. |
114 ScrollState scroll_state_; | 112 ScrollState scroll_state_; |
115 | 113 |
116 // The amount of overscroll in progress. These values are invalid when | 114 // The amount of overscroll in progress. These values are invalid when |
117 // |overscroll_mode_| is set to OVERSCROLL_NONE. | 115 // |overscroll_mode_| is set to OVERSCROLL_NONE. |
118 float overscroll_delta_x_; | 116 float overscroll_delta_x_; |
119 float overscroll_delta_y_; | 117 float overscroll_delta_y_; |
120 | 118 |
121 // The delegate that receives the overscroll updates. The delegate is not | 119 // The delegate that receives the overscroll updates. The delegate is not |
122 // owned by this controller. | 120 // owned by this controller. |
123 OverscrollControllerDelegate* delegate_; | 121 OverscrollControllerDelegate* delegate_; |
| 122 bool use_gesutre_wheel_scrolling_; |
124 | 123 |
125 DISALLOW_COPY_AND_ASSIGN(OverscrollController); | 124 DISALLOW_COPY_AND_ASSIGN(OverscrollController); |
126 }; | 125 }; |
127 | 126 |
128 } // namespace content | 127 } // namespace content |
129 | 128 |
130 #endif // CONTENT_BROWSER_RENDERER_HOST_OVERSCROLL_CONTROLLER_H_ | 129 #endif // CONTENT_BROWSER_RENDERER_HOST_OVERSCROLL_CONTROLLER_H_ |
OLD | NEW |