Chromium Code Reviews| 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 22 matching lines...) Expand all Loading... | |
| 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. | 39 // |client| must be valid for the duration of the effect's lifetime. |
| 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 // This constructor is for test only. | |
|
majidvp
2017/07/12 21:04:21
Why is this needed? Can't we just use the above co
sunyunjia
2017/07/19 20:44:12
Done.
| |
| 44 OverscrollGlow(); | |
| 43 ~OverscrollGlow(); | 45 ~OverscrollGlow(); |
| 44 | 46 |
| 45 // Called when the root content layer overscrolls. | 47 // Called when the root content layer overscrolls. |
| 46 // |accumulated_overscroll| and |overscroll_delta| are in device pixels, while | 48 // |accumulated_overscroll| and |overscroll_delta| are in device pixels, while |
| 47 // |velocity| is in device pixels / second. | 49 // |velocity| is in device pixels / second. |
| 48 // |overscroll_location| is the coordinate of the causal overscrolling event. | 50 // |overscroll_location| is the coordinate of the causal overscrolling event. |
| 49 // Returns true if the effect still needs animation ticks. | 51 // Returns true if the effect still needs animation ticks. |
| 50 bool OnOverscrolled(base::TimeTicks current_time, | 52 virtual bool OnOverscrolled(base::TimeTicks current_time, |
| 51 const gfx::Vector2dF& accumulated_overscroll, | 53 const gfx::Vector2dF& accumulated_overscroll, |
| 52 gfx::Vector2dF overscroll_delta, | 54 gfx::Vector2dF overscroll_delta, |
| 53 gfx::Vector2dF velocity, | 55 gfx::Vector2dF velocity, |
| 54 const gfx::Vector2dF& overscroll_location); | 56 const gfx::Vector2dF& overscroll_location); |
| 55 | 57 |
| 56 // Returns true if the effect still needs animation ticks, with effect layers | 58 // Returns true if the effect still needs animation ticks, with effect layers |
| 57 // attached to |parent_layer| if necessary. | 59 // attached to |parent_layer| if necessary. |
| 58 // Note: The effect will detach itself when no further animation is required. | 60 // Note: The effect will detach itself when no further animation is required. |
| 59 bool Animate(base::TimeTicks current_time, cc::Layer* parent_layer); | 61 bool Animate(base::TimeTicks current_time, cc::Layer* parent_layer); |
| 60 | 62 |
| 61 // Update the effect according to the most recent display parameters, | 63 // Update the effect according to the most recent display parameters, |
| 62 // Note: All dimensions are in device pixels. | 64 // Note: All dimensions are in device pixels. |
| 63 void OnFrameUpdated(const gfx::SizeF& viewport_size, | 65 void OnFrameUpdated(const gfx::SizeF& viewport_size, |
| 64 const gfx::SizeF& content_size, | 66 const gfx::SizeF& content_size, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 bool allow_vertical_overscroll_; | 106 bool allow_vertical_overscroll_; |
| 105 | 107 |
| 106 scoped_refptr<cc::Layer> root_layer_; | 108 scoped_refptr<cc::Layer> root_layer_; |
| 107 | 109 |
| 108 DISALLOW_COPY_AND_ASSIGN(OverscrollGlow); | 110 DISALLOW_COPY_AND_ASSIGN(OverscrollGlow); |
| 109 }; | 111 }; |
| 110 | 112 |
| 111 } // namespace ui | 113 } // namespace ui |
| 112 | 114 |
| 113 #endif // UI_ANDROID_OVERSCROLL_GLOW_H_ | 115 #endif // UI_ANDROID_OVERSCROLL_GLOW_H_ |
| OLD | NEW |