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