| 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/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "cc/base/cc_export.h" | 10 #include "cc/base/cc_export.h" |
| 11 #include "cc/base/swap_promise_monitor.h" | 11 #include "cc/base/swap_promise_monitor.h" |
| 12 #include "cc/input/scrollbar.h" | 12 #include "cc/input/scrollbar.h" |
| 13 | 13 |
| 14 namespace gfx { | 14 namespace gfx { |
| 15 class Point; | 15 class Point; |
| 16 class PointF; | 16 class PointF; |
| 17 class Vector2d; | 17 class Vector2d; |
| 18 class Vector2dF; | 18 class Vector2dF; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace ui { struct LatencyInfo; } | 21 namespace ui { struct LatencyInfo; } |
| 22 | 22 |
| 23 namespace cc { | 23 namespace cc { |
| 24 | 24 |
| 25 class LayerScrollOffsetDelegate; | 25 class LayerScrollOffsetDelegate; |
| 26 | 26 |
| 27 struct DidOverscrollParams { |
| 28 gfx::Vector2dF accumulated_overscroll; |
| 29 gfx::Vector2dF latest_overscroll_delta; |
| 30 gfx::Vector2dF current_fling_velocity; |
| 31 }; |
| 32 |
| 27 class CC_EXPORT InputHandlerClient { | 33 class CC_EXPORT InputHandlerClient { |
| 28 public: | 34 public: |
| 29 virtual ~InputHandlerClient() {} | 35 virtual ~InputHandlerClient() {} |
| 30 | 36 |
| 31 virtual void WillShutdown() = 0; | 37 virtual void WillShutdown() = 0; |
| 32 virtual void Animate(base::TimeTicks time) = 0; | 38 virtual void Animate(base::TimeTicks time) = 0; |
| 33 virtual void MainThreadHasStoppedFlinging() = 0; | 39 virtual void MainThreadHasStoppedFlinging() = 0; |
| 34 | 40 |
| 35 // Called when scroll deltas reaching the root scrolling layer go unused. | 41 // Called when scroll deltas reaching the root scrolling layer go unused. |
| 36 // The accumulated overscroll is scoped by the most recent call to | 42 // The accumulated overscroll is scoped by the most recent call to |
| 37 // InputHandler::ScrollBegin. | 43 // InputHandler::ScrollBegin. |
| 38 virtual void DidOverscroll(const gfx::Vector2dF& accumulated_overscroll, | 44 virtual void DidOverscroll(const DidOverscrollParams& params) = 0; |
| 39 const gfx::Vector2dF& latest_overscroll_delta) = 0; | |
| 40 | 45 |
| 41 protected: | 46 protected: |
| 42 InputHandlerClient() {} | 47 InputHandlerClient() {} |
| 43 | 48 |
| 44 private: | 49 private: |
| 45 DISALLOW_COPY_AND_ASSIGN(InputHandlerClient); | 50 DISALLOW_COPY_AND_ASSIGN(InputHandlerClient); |
| 46 }; | 51 }; |
| 47 | 52 |
| 48 // The InputHandler is a way for the embedders to interact with the impl thread | 53 // The InputHandler is a way for the embedders to interact with the impl thread |
| 49 // side of the compositor implementation. There is one InputHandler per | 54 // side of the compositor implementation. There is one InputHandler per |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 virtual bool ScrollBy(const gfx::Point& viewport_point, | 87 virtual bool ScrollBy(const gfx::Point& viewport_point, |
| 83 const gfx::Vector2dF& scroll_delta) = 0; | 88 const gfx::Vector2dF& scroll_delta) = 0; |
| 84 | 89 |
| 85 virtual bool ScrollVerticallyByPage(const gfx::Point& viewport_point, | 90 virtual bool ScrollVerticallyByPage(const gfx::Point& viewport_point, |
| 86 ScrollDirection direction) = 0; | 91 ScrollDirection direction) = 0; |
| 87 | 92 |
| 88 // Returns ScrollStarted if a layer was being actively being scrolled, | 93 // Returns ScrollStarted if a layer was being actively being scrolled, |
| 89 // ScrollIgnored if not. | 94 // ScrollIgnored if not. |
| 90 virtual ScrollStatus FlingScrollBegin() = 0; | 95 virtual ScrollStatus FlingScrollBegin() = 0; |
| 91 | 96 |
| 97 virtual void NotifyCurrentFlingVelocity(const gfx::Vector2dF& velocity) = 0; |
| 98 |
| 92 virtual void MouseMoveAt(const gfx::Point& mouse_position) = 0; | 99 virtual void MouseMoveAt(const gfx::Point& mouse_position) = 0; |
| 93 | 100 |
| 94 // Stop scrolling the selected layer. Should only be called if ScrollBegin() | 101 // Stop scrolling the selected layer. Should only be called if ScrollBegin() |
| 95 // returned ScrollStarted. | 102 // returned ScrollStarted. |
| 96 virtual void ScrollEnd() = 0; | 103 virtual void ScrollEnd() = 0; |
| 97 | 104 |
| 98 virtual void SetRootLayerScrollOffsetDelegate( | 105 virtual void SetRootLayerScrollOffsetDelegate( |
| 99 LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate) = 0; | 106 LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate) = 0; |
| 100 | 107 |
| 101 // Called when the value returned by | 108 // Called when the value returned by |
| (...skipping 30 matching lines...) Expand all Loading... |
| 132 InputHandler() {} | 139 InputHandler() {} |
| 133 virtual ~InputHandler() {} | 140 virtual ~InputHandler() {} |
| 134 | 141 |
| 135 private: | 142 private: |
| 136 DISALLOW_COPY_AND_ASSIGN(InputHandler); | 143 DISALLOW_COPY_AND_ASSIGN(InputHandler); |
| 137 }; | 144 }; |
| 138 | 145 |
| 139 } // namespace cc | 146 } // namespace cc |
| 140 | 147 |
| 141 #endif // CC_INPUT_INPUT_HANDLER_H_ | 148 #endif // CC_INPUT_INPUT_HANDLER_H_ |
| OLD | NEW |