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