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 18 matching lines...) Expand all Loading... | |
29 // Called lazily, after the initial overscrolling event. | 29 // Called lazily, after the initial overscrolling event. |
30 virtual std::unique_ptr<EdgeEffectBase> CreateEdgeEffect() = 0; | 30 virtual std::unique_ptr<EdgeEffectBase> CreateEdgeEffect() = 0; |
31 }; | 31 }; |
32 | 32 |
33 /* |OverscrollGlow| mirrors its Android counterpart, OverscrollGlow.java. | 33 /* |OverscrollGlow| mirrors its Android counterpart, OverscrollGlow.java. |
34 * Conscious tradeoffs were made to align this as closely as possible with the | 34 * Conscious tradeoffs were made to align this as closely as possible with the |
35 * original Android Java version. | 35 * original Android Java version. |
36 */ | 36 */ |
37 class UI_ANDROID_EXPORT OverscrollGlow { | 37 class UI_ANDROID_EXPORT OverscrollGlow { |
38 public: | 38 public: |
39 // |client| must be valid for the duration of the effect's lifetime. | |
majidvp
2017/07/20 13:26:55
Why remove this? This is still true for normal ope
sunyunjia
2017/07/21 13:52:23
Added it back. I was thinking of the test case.
| |
40 // The effect is enabled by default, but will remain dormant until the first | 39 // The effect is enabled by default, but will remain dormant until the first |
41 // overscroll event. | 40 // overscroll event. |
42 explicit OverscrollGlow(OverscrollGlowClient* client); | 41 explicit OverscrollGlow(OverscrollGlowClient* client); |
43 ~OverscrollGlow(); | 42 ~OverscrollGlow(); |
44 | 43 |
45 // Called when the root content layer overscrolls. | 44 // Called when the root content layer overscrolls. |
46 // |accumulated_overscroll| and |overscroll_delta| are in device pixels, while | 45 // |accumulated_overscroll| and |overscroll_delta| are in device pixels, while |
47 // |velocity| is in device pixels / second. | 46 // |velocity| is in device pixels / second. |
48 // |overscroll_location| is the coordinate of the causal overscrolling event. | 47 // |overscroll_location| is the coordinate of the causal overscrolling event. |
49 // Returns true if the effect still needs animation ticks. | 48 // Returns true if the effect still needs animation ticks. |
50 bool OnOverscrolled(base::TimeTicks current_time, | 49 virtual bool OnOverscrolled(base::TimeTicks current_time, |
51 const gfx::Vector2dF& accumulated_overscroll, | 50 const gfx::Vector2dF& accumulated_overscroll, |
52 gfx::Vector2dF overscroll_delta, | 51 gfx::Vector2dF overscroll_delta, |
53 gfx::Vector2dF velocity, | 52 gfx::Vector2dF velocity, |
54 const gfx::Vector2dF& overscroll_location); | 53 const gfx::Vector2dF& overscroll_location); |
55 | 54 |
56 // Returns true if the effect still needs animation ticks, with effect layers | 55 // Returns true if the effect still needs animation ticks, with effect layers |
57 // attached to |parent_layer| if necessary. | 56 // attached to |parent_layer| if necessary. |
58 // Note: The effect will detach itself when no further animation is required. | 57 // Note: The effect will detach itself when no further animation is required. |
59 bool Animate(base::TimeTicks current_time, cc::Layer* parent_layer); | 58 bool Animate(base::TimeTicks current_time, cc::Layer* parent_layer); |
60 | 59 |
61 // Update the effect according to the most recent display parameters, | 60 // Update the effect according to the most recent display parameters, |
62 // Note: All dimensions are in device pixels. | 61 // Note: All dimensions are in device pixels. |
63 void OnFrameUpdated(const gfx::SizeF& viewport_size, | 62 void OnFrameUpdated(const gfx::SizeF& viewport_size, |
64 const gfx::SizeF& content_size, | 63 const gfx::SizeF& content_size, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
104 bool allow_vertical_overscroll_; | 103 bool allow_vertical_overscroll_; |
105 | 104 |
106 scoped_refptr<cc::Layer> root_layer_; | 105 scoped_refptr<cc::Layer> root_layer_; |
107 | 106 |
108 DISALLOW_COPY_AND_ASSIGN(OverscrollGlow); | 107 DISALLOW_COPY_AND_ASSIGN(OverscrollGlow); |
109 }; | 108 }; |
110 | 109 |
111 } // namespace ui | 110 } // namespace ui |
112 | 111 |
113 #endif // UI_ANDROID_OVERSCROLL_GLOW_H_ | 112 #endif // UI_ANDROID_OVERSCROLL_GLOW_H_ |
OLD | NEW |