| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // Returns true if the effect still needs animation ticks. | 48 // Returns true if the effect still needs animation ticks. |
| 49 bool OnOverscrolled(cc::Layer* overscrolling_layer, | 49 bool OnOverscrolled(cc::Layer* overscrolling_layer, |
| 50 base::TimeTicks current_time, | 50 base::TimeTicks current_time, |
| 51 gfx::Vector2dF overscroll, | 51 gfx::Vector2dF overscroll, |
| 52 gfx::Vector2dF velocity); | 52 gfx::Vector2dF velocity); |
| 53 | 53 |
| 54 // Returns true if the effect still needs animation ticks. | 54 // Returns true if the effect still needs animation ticks. |
| 55 // Note: The effect will detach itself when no further animation is required. | 55 // Note: The effect will detach itself when no further animation is required. |
| 56 bool Animate(base::TimeTicks current_time); | 56 bool Animate(base::TimeTicks current_time); |
| 57 | 57 |
| 58 // Horizontal overscroll will be ignored when false. | |
| 59 void set_horizontal_overscroll_enabled(bool enabled) { | |
| 60 horizontal_overscroll_enabled_ = enabled; | |
| 61 } | |
| 62 // Vertical overscroll will be ignored when false. | |
| 63 void set_vertical_overscroll_enabled(bool enabled) { | |
| 64 vertical_overscroll_enabled_ = enabled; | |
| 65 } | |
| 66 // The size of the layer for which edges will be animated. | 58 // The size of the layer for which edges will be animated. |
| 67 void set_size(gfx::SizeF size) { | 59 void set_size(gfx::SizeF size) { |
| 68 size_ = size; | 60 size_ = size; |
| 69 } | 61 } |
| 70 | 62 |
| 71 private: | 63 private: |
| 72 enum Axis { AXIS_X, AXIS_Y }; | 64 enum Axis { AXIS_X, AXIS_Y }; |
| 73 | 65 |
| 74 OverscrollGlow(bool enabled); | 66 OverscrollGlow(bool enabled); |
| 75 | 67 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 89 | 81 |
| 90 EdgeEffect* GetOppositeEdge(int edge_index); | 82 EdgeEffect* GetOppositeEdge(int edge_index); |
| 91 | 83 |
| 92 scoped_ptr<EdgeEffect> edge_effects_[EdgeEffect::EDGE_COUNT]; | 84 scoped_ptr<EdgeEffect> edge_effects_[EdgeEffect::EDGE_COUNT]; |
| 93 | 85 |
| 94 bool enabled_; | 86 bool enabled_; |
| 95 bool initialized_; | 87 bool initialized_; |
| 96 gfx::SizeF size_; | 88 gfx::SizeF size_; |
| 97 gfx::Vector2dF old_overscroll_; | 89 gfx::Vector2dF old_overscroll_; |
| 98 gfx::Vector2dF old_velocity_; | 90 gfx::Vector2dF old_velocity_; |
| 99 bool horizontal_overscroll_enabled_; | |
| 100 bool vertical_overscroll_enabled_; | |
| 101 | 91 |
| 102 scoped_refptr<cc::Layer> root_layer_; | 92 scoped_refptr<cc::Layer> root_layer_; |
| 103 | 93 |
| 104 DISALLOW_COPY_AND_ASSIGN(OverscrollGlow); | 94 DISALLOW_COPY_AND_ASSIGN(OverscrollGlow); |
| 105 }; | 95 }; |
| 106 | 96 |
| 107 } // namespace content | 97 } // namespace content |
| 108 | 98 |
| 109 #endif // CONTENT_BROWSER_ANDROID_SCROLL_GLOW_H_ | 99 #endif // CONTENT_BROWSER_ANDROID_SCROLL_GLOW_H_ |
| OLD | NEW |