OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_ANDROID_OVERSCROLL_GLOW_H_ | 5 #ifndef UI_ANDROID_OVERSCROLL_GLOW_H_ |
6 #define UI_ANDROID_OVERSCROLL_GLOW_H_ | 6 #define UI_ANDROID_OVERSCROLL_GLOW_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 // The effect is enabled by default, but will remain dormant until the first | 40 // The effect is enabled by default, but will remain dormant until the first |
41 // overscroll event. | 41 // overscroll event. |
42 explicit OverscrollGlow(OverscrollGlowClient* client); | 42 explicit OverscrollGlow(OverscrollGlowClient* client); |
43 ~OverscrollGlow(); | 43 ~OverscrollGlow(); |
44 | 44 |
45 // Called when the root content layer overscrolls. | 45 // Called when the root content layer overscrolls. |
46 // |accumulated_overscroll| and |overscroll_delta| are in device pixels, while | 46 // |accumulated_overscroll| and |overscroll_delta| are in device pixels, while |
47 // |velocity| is in device pixels / second. | 47 // |velocity| is in device pixels / second. |
48 // |overscroll_location| is the coordinate of the causal overscrolling event. | 48 // |overscroll_location| is the coordinate of the causal overscrolling event. |
49 // Returns true if the effect still needs animation ticks. | 49 // Returns true if the effect still needs animation ticks. |
50 bool OnOverscrolled(base::TimeTicks current_time, | 50 // This method is made virtual for mocking. |
51 const gfx::Vector2dF& accumulated_overscroll, | 51 virtual bool OnOverscrolled(base::TimeTicks current_time, |
52 gfx::Vector2dF overscroll_delta, | 52 gfx::Vector2dF accumulated_overscroll, |
53 gfx::Vector2dF velocity, | 53 gfx::Vector2dF overscroll_delta, |
54 const gfx::Vector2dF& overscroll_location); | 54 gfx::Vector2dF velocity, |
| 55 gfx::Vector2dF overscroll_location); |
55 | 56 |
56 // Returns true if the effect still needs animation ticks, with effect layers | 57 // Returns true if the effect still needs animation ticks, with effect layers |
57 // attached to |parent_layer| if necessary. | 58 // attached to |parent_layer| if necessary. |
58 // Note: The effect will detach itself when no further animation is required. | 59 // Note: The effect will detach itself when no further animation is required. |
59 bool Animate(base::TimeTicks current_time, cc::Layer* parent_layer); | 60 bool Animate(base::TimeTicks current_time, cc::Layer* parent_layer); |
60 | 61 |
61 // Update the effect according to the most recent display parameters, | 62 // Update the effect according to the most recent display parameters, |
62 // Note: All dimensions are in device pixels. | 63 // Note: All dimensions are in device pixels. |
63 void OnFrameUpdated(const gfx::SizeF& viewport_size, | 64 void OnFrameUpdated(const gfx::SizeF& viewport_size, |
64 const gfx::SizeF& content_size, | 65 const gfx::SizeF& content_size, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 bool allow_vertical_overscroll_; | 105 bool allow_vertical_overscroll_; |
105 | 106 |
106 scoped_refptr<cc::Layer> root_layer_; | 107 scoped_refptr<cc::Layer> root_layer_; |
107 | 108 |
108 DISALLOW_COPY_AND_ASSIGN(OverscrollGlow); | 109 DISALLOW_COPY_AND_ASSIGN(OverscrollGlow); |
109 }; | 110 }; |
110 | 111 |
111 } // namespace ui | 112 } // namespace ui |
112 | 113 |
113 #endif // UI_ANDROID_OVERSCROLL_GLOW_H_ | 114 #endif // UI_ANDROID_OVERSCROLL_GLOW_H_ |
OLD | NEW |