Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Unified Diff: content/browser/android/overscroll_glow.h

Issue 17413016: Fix overscroll glow when the FIP dialog is active (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Explicit enable on creation Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/android/overscroll_glow.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
« no previous file with comments | « no previous file | content/browser/android/overscroll_glow.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698