| 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/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "third_party/WebKit/public/web/WebInputEvent.h" | 10 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 float delta_y, | 99 float delta_y, |
| 100 WebKit::WebInputEvent::Type event_type); | 100 WebKit::WebInputEvent::Type event_type); |
| 101 | 101 |
| 102 // Completes the desired action from the current gesture. | 102 // Completes the desired action from the current gesture. |
| 103 void CompleteAction(); | 103 void CompleteAction(); |
| 104 | 104 |
| 105 // Sets the overscroll mode (and triggers callback in the delegate when | 105 // Sets the overscroll mode (and triggers callback in the delegate when |
| 106 // appropriate). | 106 // appropriate). |
| 107 void SetOverscrollMode(OverscrollMode new_mode); | 107 void SetOverscrollMode(OverscrollMode new_mode); |
| 108 | 108 |
| 109 // Returns whether the input event should be forwarded to the | |
| 110 // RenderWidgetHost. | |
| 111 bool ShouldForwardToHost(const WebKit::WebInputEvent& event) const; | |
| 112 | |
| 113 // The RenderWidgetHost that owns this overscroll controller. | 109 // The RenderWidgetHost that owns this overscroll controller. |
| 114 RenderWidgetHostImpl* render_widget_host_; | 110 RenderWidgetHostImpl* render_widget_host_; |
| 115 | 111 |
| 116 // The current state of overscroll gesture. | 112 // The current state of overscroll gesture. |
| 117 OverscrollMode overscroll_mode_; | 113 OverscrollMode overscroll_mode_; |
| 118 | 114 |
| 119 // Used to keep track of the scrolling state. | 115 // Used to keep track of the scrolling state. |
| 120 // If scrolling starts, and some scroll events are consumed at the beginning | 116 // If scrolling starts, and some scroll events are consumed at the beginning |
| 121 // of the scroll (i.e. some content on the web-page was scrolled), then do not | 117 // of the scroll (i.e. some content on the web-page was scrolled), then do not |
| 122 // process any of the subsequent scroll events for generating overscroll | 118 // process any of the subsequent scroll events for generating overscroll |
| 123 // gestures. | 119 // gestures. |
| 124 ScrollState scroll_state_; | 120 ScrollState scroll_state_; |
| 125 | 121 |
| 126 // The amount of overscroll in progress. These values are invalid when | 122 // The amount of overscroll in progress. These values are invalid when |
| 127 // |overscroll_mode_| is set to OVERSCROLL_NONE. | 123 // |overscroll_mode_| is set to OVERSCROLL_NONE. |
| 128 float overscroll_delta_x_; | 124 float overscroll_delta_x_; |
| 129 float overscroll_delta_y_; | 125 float overscroll_delta_y_; |
| 130 | 126 |
| 131 // The delegate that receives the overscroll updates. The delegate is not | 127 // The delegate that receives the overscroll updates. The delegate is not |
| 132 // owned by this controller. | 128 // owned by this controller. |
| 133 OverscrollControllerDelegate* delegate_; | 129 OverscrollControllerDelegate* delegate_; |
| 134 | 130 |
| 135 DISALLOW_COPY_AND_ASSIGN(OverscrollController); | 131 DISALLOW_COPY_AND_ASSIGN(OverscrollController); |
| 136 }; | 132 }; |
| 137 | 133 |
| 138 } // namespace content | 134 } // namespace content |
| 139 | 135 |
| 140 #endif // CONTENT_BROWSER_RENDERER_HOST_OVERSCROLL_CONTROLLER_H_ | 136 #endif // CONTENT_BROWSER_RENDERER_HOST_OVERSCROLL_CONTROLLER_H_ |
| OLD | NEW |