Index: content/browser/android/overscroll_glow.h |
diff --git a/content/browser/android/overscroll_glow.h b/content/browser/android/overscroll_glow.h |
index 31497cd6ffed4322e2d5051b51986dd277294fc2..5cd763de5b853932158119484fd548c95ce9668e 100644 |
--- a/content/browser/android/overscroll_glow.h |
+++ b/content/browser/android/overscroll_glow.h |
@@ -26,35 +26,47 @@ namespace content { |
*/ |
class OverscrollGlow { |
public: |
- static scoped_ptr<OverscrollGlow> Create(); |
+ // Create and initialize a new effect with the necessary resources. |
+ // If |enabled| is false, the effect will be be deactivated until |
+ // SetEnabled(true) is called. |
+ // The caller should attach |root_layer| to the desired layer tree. |
+ static scoped_ptr<OverscrollGlow> Create(bool enabled); |
// Force loading of any necessary resources. This function is thread-safe. |
static void EnsureResources(); |
~OverscrollGlow(); |
+ // If false, the glow will be deactivated, and subsequent calls to |
+ // OnOverscrolled or Animate will have no effect. |
+ void SetEnabled(bool enabled); |
+ |
+ // |overscroll| is the accumulated overscroll for the current gesture. |
+ // |velocity| is the instantaneous velocity for the overscroll. |
void OnOverscrolled(base::TimeTicks current_time, |
gfx::Vector2dF overscroll, |
gfx::Vector2dF velocity); |
+ |
// Returns true if the effect still needs animation ticks. |
bool Animate(base::TimeTicks current_time); |
- void Finish(); |
// Returns true if the effect needs animation ticks. |
- bool IsActive() const; |
+ bool NeedsAnimate() const; |
// The root layer of the effect (not necessarily of the tree). |
scoped_refptr<cc::Layer> root_layer() const { |
return root_layer_; |
} |
+ // Horizontal overscroll will be ignored when false. |
void set_horizontal_overscroll_enabled(bool enabled) { |
horizontal_overscroll_enabled_ = enabled; |
} |
+ // Vertical overscroll will be ignored when false. |
void set_vertical_overscroll_enabled(bool enabled) { |
vertical_overscroll_enabled_ = enabled; |
} |
- |
+ // The size of the layer for which edges will be animated. |
void set_size(gfx::SizeF size) { |
size_ = size; |
} |
@@ -62,7 +74,7 @@ class OverscrollGlow { |
private: |
enum Axis { AXIS_X, AXIS_Y }; |
- OverscrollGlow(const SkBitmap& edge, const SkBitmap& glow); |
+ OverscrollGlow(bool enabled, const SkBitmap& edge, const SkBitmap& glow); |
void Pull(base::TimeTicks current_time, |
gfx::Vector2dF added_overscroll); |
@@ -78,6 +90,7 @@ class OverscrollGlow { |
scoped_ptr<EdgeEffect> edge_effects_[EdgeEffect::EDGE_COUNT]; |
+ bool enabled_; |
gfx::SizeF size_; |
gfx::Vector2dF old_overscroll_; |
gfx::Vector2dF old_velocity_; |