Chromium Code Reviews| 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 <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 98 ScrollThread thread; | 98 ScrollThread thread; |
| 99 uint32_t main_thread_scrolling_reasons; | 99 uint32_t main_thread_scrolling_reasons; |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 enum ScrollInputType { | 102 enum ScrollInputType { |
| 103 TOUCHSCREEN, | 103 TOUCHSCREEN, |
| 104 WHEEL, | 104 WHEEL, |
| 105 NON_BUBBLING_GESTURE | 105 NON_BUBBLING_GESTURE |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 enum TouchEventDisposition { | |
| 109 HANDLE, | |
| 110 NOT_HANDLE, | |
| 111 NOT_HANDLE_NON_BLOCKING_DUE_TO_FLING | |
| 112 }; | |
| 113 | |
| 108 // Binds a client to this handler to receive notifications. Only one client | 114 // Binds a client to this handler to receive notifications. Only one client |
| 109 // can be bound to an InputHandler. The client must live at least until the | 115 // can be bound to an InputHandler. The client must live at least until the |
| 110 // handler calls WillShutdown() on the client. | 116 // handler calls WillShutdown() on the client. |
| 111 virtual void BindToClient(InputHandlerClient* client) = 0; | 117 virtual void BindToClient(InputHandlerClient* client) = 0; |
| 112 | 118 |
| 113 // Selects a layer to be scrolled using the |scroll_state| start position. | 119 // Selects a layer to be scrolled using the |scroll_state| start position. |
| 114 // Returns SCROLL_STARTED if the layer at the coordinates can be scrolled, | 120 // Returns SCROLL_STARTED if the layer at the coordinates can be scrolled, |
| 115 // SCROLL_ON_MAIN_THREAD if the scroll event should instead be delegated to | 121 // SCROLL_ON_MAIN_THREAD if the scroll event should instead be delegated to |
| 116 // the main thread, or SCROLL_IGNORED if there is nothing to be scrolled at | 122 // the main thread, or SCROLL_IGNORED if there is nothing to be scrolled at |
| 117 // the given coordinates. | 123 // the given coordinates. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 181 // Returns true if there is an active scroll on the viewport. | 187 // Returns true if there is an active scroll on the viewport. |
| 182 virtual bool IsCurrentlyScrollingViewport() const = 0; | 188 virtual bool IsCurrentlyScrollingViewport() const = 0; |
| 183 | 189 |
| 184 // Whether the layer under |viewport_point| is the currently scrolling layer. | 190 // Whether the layer under |viewport_point| is the currently scrolling layer. |
| 185 virtual bool IsCurrentlyScrollingLayerAt(const gfx::Point& viewport_point, | 191 virtual bool IsCurrentlyScrollingLayerAt(const gfx::Point& viewport_point, |
| 186 ScrollInputType type) const = 0; | 192 ScrollInputType type) const = 0; |
| 187 | 193 |
| 188 virtual EventListenerProperties GetEventListenerProperties( | 194 virtual EventListenerProperties GetEventListenerProperties( |
| 189 EventListenerClass event_class) const = 0; | 195 EventListenerClass event_class) const = 0; |
| 190 | 196 |
| 191 // Whether the page should be given the opportunity to suppress scrolling by | 197 // It returns if the page has a touch handler or not. If it has, whether the |
| 192 // consuming touch events that started at |viewport_point|. | 198 // page should suppress scrolling by consuming touch events that started at |
| 193 virtual bool DoTouchEventsBlockScrollAt(const gfx::Point& viewport_point) = 0; | 199 // |viewport_point|. |
| 200 virtual EventListenerProperties DoTouchHandlersBlockScrollAt( | |
|
bokan
2016/11/15 22:42:40
Do____ implies the method returns a bool. I would
lanwei
2016/11/16 21:13:28
Done.
| |
| 201 const gfx::Point& viewport_point) = 0; | |
| 194 | 202 |
| 195 // Calling CreateLatencyInfoSwapPromiseMonitor() to get a scoped | 203 // Calling CreateLatencyInfoSwapPromiseMonitor() to get a scoped |
| 196 // LatencyInfoSwapPromiseMonitor. During the life time of the | 204 // LatencyInfoSwapPromiseMonitor. During the life time of the |
| 197 // LatencyInfoSwapPromiseMonitor, if SetNeedsRedraw() or SetNeedsRedrawRect() | 205 // LatencyInfoSwapPromiseMonitor, if SetNeedsRedraw() or SetNeedsRedrawRect() |
| 198 // is called on LayerTreeHostImpl, the original latency info will be turned | 206 // is called on LayerTreeHostImpl, the original latency info will be turned |
| 199 // into a LatencyInfoSwapPromise. | 207 // into a LatencyInfoSwapPromise. |
| 200 virtual std::unique_ptr<SwapPromiseMonitor> | 208 virtual std::unique_ptr<SwapPromiseMonitor> |
| 201 CreateLatencyInfoSwapPromiseMonitor(ui::LatencyInfo* latency) = 0; | 209 CreateLatencyInfoSwapPromiseMonitor(ui::LatencyInfo* latency) = 0; |
| 202 | 210 |
| 203 virtual ScrollElasticityHelper* CreateScrollElasticityHelper() = 0; | 211 virtual ScrollElasticityHelper* CreateScrollElasticityHelper() = 0; |
| 204 | 212 |
| 205 // Called by the single-threaded UI Compositor to get or set the scroll offset | 213 // Called by the single-threaded UI Compositor to get or set the scroll offset |
| 206 // on the impl side. Retruns false if |layer_id| isn't in the active tree. | 214 // on the impl side. Retruns false if |layer_id| isn't in the active tree. |
| 207 virtual bool GetScrollOffsetForLayer(int layer_id, | 215 virtual bool GetScrollOffsetForLayer(int layer_id, |
| 208 gfx::ScrollOffset* offset) = 0; | 216 gfx::ScrollOffset* offset) = 0; |
| 209 virtual bool ScrollLayerTo(int layer_id, const gfx::ScrollOffset& offset) = 0; | 217 virtual bool ScrollLayerTo(int layer_id, const gfx::ScrollOffset& offset) = 0; |
| 210 | 218 |
| 211 protected: | 219 protected: |
| 212 InputHandler() {} | 220 InputHandler() {} |
| 213 virtual ~InputHandler() {} | 221 virtual ~InputHandler() {} |
| 214 | 222 |
| 215 private: | 223 private: |
| 216 DISALLOW_COPY_AND_ASSIGN(InputHandler); | 224 DISALLOW_COPY_AND_ASSIGN(InputHandler); |
| 217 }; | 225 }; |
| 218 | 226 |
| 219 } // namespace cc | 227 } // namespace cc |
| 220 | 228 |
| 221 #endif // CC_INPUT_INPUT_HANDLER_H_ | 229 #endif // CC_INPUT_INPUT_HANDLER_H_ |
| OLD | NEW |