OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 CC_INPUT_INPUT_HANDLER_H_ | 5 #ifndef CC_INPUT_INPUT_HANDLER_H_ |
6 #define CC_INPUT_INPUT_HANDLER_H_ | 6 #define CC_INPUT_INPUT_HANDLER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // Note these are used in a histogram. Do not reorder or delete existing | 77 // Note these are used in a histogram. Do not reorder or delete existing |
78 // entries. | 78 // entries. |
79 enum ScrollStatus { | 79 enum ScrollStatus { |
80 SCROLL_ON_MAIN_THREAD = 0, | 80 SCROLL_ON_MAIN_THREAD = 0, |
81 SCROLL_STARTED, | 81 SCROLL_STARTED, |
82 SCROLL_IGNORED, | 82 SCROLL_IGNORED, |
83 SCROLL_UNKNOWN, | 83 SCROLL_UNKNOWN, |
84 // This must be the last entry. | 84 // This must be the last entry. |
85 ScrollStatusCount | 85 ScrollStatusCount |
86 }; | 86 }; |
87 enum ScrollInputType { GESTURE, WHEEL, NON_BUBBLING_GESTURE }; | 87 enum ScrollInputType { GESTURE, WHEEL, ANIMATED_WHEEL, NON_BUBBLING_GESTURE }; |
88 | 88 |
89 // Binds a client to this handler to receive notifications. Only one client | 89 // Binds a client to this handler to receive notifications. Only one client |
90 // can be bound to an InputHandler. The client must live at least until the | 90 // can be bound to an InputHandler. The client must live at least until the |
91 // handler calls WillShutdown() on the client. | 91 // handler calls WillShutdown() on the client. |
92 virtual void BindToClient(InputHandlerClient* client) = 0; | 92 virtual void BindToClient(InputHandlerClient* client) = 0; |
93 | 93 |
94 // Selects a layer to be scrolled at a given point in viewport (logical | 94 // Selects a layer to be scrolled at a given point in viewport (logical |
95 // pixel) coordinates. Returns SCROLL_STARTED if the layer at the coordinates | 95 // pixel) coordinates. Returns SCROLL_STARTED if the layer at the coordinates |
96 // can be scrolled, SCROLL_ON_MAIN_THREAD if the scroll event should instead | 96 // can be scrolled, SCROLL_ON_MAIN_THREAD if the scroll event should instead |
97 // be delegated to the main thread, or SCROLL_IGNORED if there is nothing to | 97 // be delegated to the main thread, or SCROLL_IGNORED if there is nothing to |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 const gfx::ScrollOffset& root_offset) = 0; | 144 const gfx::ScrollOffset& root_offset) = 0; |
145 | 145 |
146 virtual void PinchGestureBegin() = 0; | 146 virtual void PinchGestureBegin() = 0; |
147 virtual void PinchGestureUpdate(float magnify_delta, | 147 virtual void PinchGestureUpdate(float magnify_delta, |
148 const gfx::Point& anchor) = 0; | 148 const gfx::Point& anchor) = 0; |
149 virtual void PinchGestureEnd() = 0; | 149 virtual void PinchGestureEnd() = 0; |
150 | 150 |
151 // Request another callback to InputHandlerClient::Animate(). | 151 // Request another callback to InputHandlerClient::Animate(). |
152 virtual void SetNeedsAnimateInput() = 0; | 152 virtual void SetNeedsAnimateInput() = 0; |
153 | 153 |
154 // If there is a scroll active, this reports whether the scroll is on the | 154 // Returns true if there is an active scroll on the inner viewport layer. |
155 // root layer, or on some other sublayer. | 155 virtual bool IsCurrentlyScrollingInnerViewport() const = 0; |
156 virtual bool IsCurrentlyScrollingRoot() const = 0; | |
157 | 156 |
158 // Whether the layer under |viewport_point| is the currently scrolling layer. | 157 // Whether the layer under |viewport_point| is the currently scrolling layer. |
159 virtual bool IsCurrentlyScrollingLayerAt(const gfx::Point& viewport_point, | 158 virtual bool IsCurrentlyScrollingLayerAt(const gfx::Point& viewport_point, |
160 ScrollInputType type) const = 0; | 159 ScrollInputType type) const = 0; |
161 | 160 |
162 virtual bool HaveWheelEventHandlersAt(const gfx::Point& viewport_point) = 0; | 161 virtual bool HaveWheelEventHandlersAt(const gfx::Point& viewport_point) = 0; |
163 | 162 |
164 // Whether the page should be given the opportunity to suppress scrolling by | 163 // Whether the page should be given the opportunity to suppress scrolling by |
165 // consuming touch events that started at |viewport_point|. | 164 // consuming touch events that started at |viewport_point|. |
166 virtual bool DoTouchEventsBlockScrollAt(const gfx::Point& viewport_point) = 0; | 165 virtual bool DoTouchEventsBlockScrollAt(const gfx::Point& viewport_point) = 0; |
(...skipping 12 matching lines...) Expand all Loading... |
179 InputHandler() {} | 178 InputHandler() {} |
180 virtual ~InputHandler() {} | 179 virtual ~InputHandler() {} |
181 | 180 |
182 private: | 181 private: |
183 DISALLOW_COPY_AND_ASSIGN(InputHandler); | 182 DISALLOW_COPY_AND_ASSIGN(InputHandler); |
184 }; | 183 }; |
185 | 184 |
186 } // namespace cc | 185 } // namespace cc |
187 | 186 |
188 #endif // CC_INPUT_INPUT_HANDLER_H_ | 187 #endif // CC_INPUT_INPUT_HANDLER_H_ |
OLD | NEW |