| 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 CONTENT_BROWSER_ANDROID_OVERSCROLL_GLOW_H_ | 5 #ifndef CONTENT_BROWSER_ANDROID_OVERSCROLL_GLOW_H_ |
| 6 #define CONTENT_BROWSER_ANDROID_OVERSCROLL_GLOW_H_ | 6 #define CONTENT_BROWSER_ANDROID_OVERSCROLL_GLOW_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 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 ~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 // Returns true if the effect still needs animation ticks. | 49 // Returns true if the effect still needs animation ticks. |
| 49 bool OnOverscrolled(base::TimeTicks current_time, | 50 bool OnOverscrolled(base::TimeTicks current_time, |
| 50 const gfx::Vector2dF& accumulated_overscroll, | 51 const gfx::Vector2dF& accumulated_overscroll, |
| 51 gfx::Vector2dF overscroll_delta, | 52 gfx::Vector2dF overscroll_delta, |
| 52 gfx::Vector2dF velocity, | 53 gfx::Vector2dF velocity, |
| 53 const gfx::Vector2dF& overscroll_location); | 54 const gfx::Vector2dF& overscroll_location); |
| 54 | 55 |
| 55 // Returns true if the effect still needs animation ticks, with effect layers | 56 // Returns true if the effect still needs animation ticks, with effect layers |
| 56 // attached to |parent_layer| if necessary. | 57 // attached to |parent_layer| if necessary. |
| 57 // Note: The effect will detach itself when no further animation is required. | 58 // Note: The effect will detach itself when no further animation is required. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 void Release(base::TimeTicks current_time); | 92 void Release(base::TimeTicks current_time); |
| 92 | 93 |
| 93 EdgeEffectBase* GetOppositeEdge(int edge_index); | 94 EdgeEffectBase* GetOppositeEdge(int edge_index); |
| 94 | 95 |
| 95 OverscrollGlowClient* const client_; | 96 OverscrollGlowClient* const client_; |
| 96 scoped_ptr<EdgeEffectBase> edge_effects_[EDGE_COUNT]; | 97 scoped_ptr<EdgeEffectBase> edge_effects_[EDGE_COUNT]; |
| 97 | 98 |
| 98 gfx::SizeF viewport_size_; | 99 gfx::SizeF viewport_size_; |
| 99 float edge_offsets_[EDGE_COUNT]; | 100 float edge_offsets_[EDGE_COUNT]; |
| 100 bool initialized_; | 101 bool initialized_; |
| 102 bool allow_horizontal_overscroll_; |
| 103 bool allow_vertical_overscroll_; |
| 101 | 104 |
| 102 scoped_refptr<cc::Layer> root_layer_; | 105 scoped_refptr<cc::Layer> root_layer_; |
| 103 | 106 |
| 104 DISALLOW_COPY_AND_ASSIGN(OverscrollGlow); | 107 DISALLOW_COPY_AND_ASSIGN(OverscrollGlow); |
| 105 }; | 108 }; |
| 106 | 109 |
| 107 } // namespace content | 110 } // namespace content |
| 108 | 111 |
| 109 #endif // CONTENT_BROWSER_ANDROID_OVERSCROLL_GLOW_H_ | 112 #endif // CONTENT_BROWSER_ANDROID_OVERSCROLL_GLOW_H_ |
| OLD | NEW |