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

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

Issue 82553015: Switch the android overscroll glow to use UIResources. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor naming changes Created 7 years, 1 month 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
Index: content/browser/android/overscroll_glow.h
diff --git a/content/browser/android/overscroll_glow.h b/content/browser/android/overscroll_glow.h
index ba1d48ff74e5418baadfed69fc1252b82e2f30dd..8fad7939a6a86293ea8e78c4b518a2c16fb51da2 100644
--- a/content/browser/android/overscroll_glow.h
+++ b/content/browser/android/overscroll_glow.h
@@ -8,7 +8,9 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/time/time.h"
+#include "cc/layers/ui_resource_layer.h"
#include "content/browser/android/edge_effect.h"
+#include "ui/gfx/size.h"
#include "ui/gfx/size_f.h"
#include "ui/gfx/vector2d_f.h"
@@ -16,6 +18,7 @@ class SkBitmap;
namespace cc {
class Layer;
+class UIResourceLayer;
}
namespace content {
@@ -32,9 +35,6 @@ class OverscrollGlow {
// The caller should attach |root_layer| to the desired layer tree.
static scoped_ptr<OverscrollGlow> Create(bool enabled, gfx::SizeF size);
- // 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
@@ -53,10 +53,16 @@ class OverscrollGlow {
// Returns true if the effect needs animation ticks.
bool NeedsAnimate() const;
- // The root layer of the effect (not necessarily of the tree).
- scoped_refptr<cc::Layer> root_layer() const {
- return root_layer_;
- }
+ void AttachLayerTo(scoped_refptr<cc::Layer> layer);
+ void RemoveLayer();
+ bool IsAttached() const;
+
+ // Sets the layer resources, which are allocated on the compositor. Return
+ // true if the resources have been updated with new values, false otherwise.
+ bool SetLayerResources(cc::UIResourceId edge_resource_id,
+ cc::UIResourceId glow_resource_id,
+ gfx::Size edge_bitmap_size,
+ gfx::Size glow_bitmap_size);
// Horizontal overscroll will be ignored when false.
void set_horizontal_overscroll_enabled(bool enabled) {
@@ -75,9 +81,7 @@ class OverscrollGlow {
enum Axis { AXIS_X, AXIS_Y };
OverscrollGlow(bool enabled,
- gfx::SizeF size,
- const SkBitmap& edge,
- const SkBitmap& glow);
+ gfx::SizeF size);
void Pull(base::TimeTicks current_time,
gfx::Vector2dF added_overscroll);
@@ -100,6 +104,12 @@ class OverscrollGlow {
bool vertical_overscroll_enabled_;
scoped_refptr<cc::Layer> root_layer_;
+ scoped_refptr<cc::UIResourceLayer> edge_layer_;
+ scoped_refptr<cc::UIResourceLayer> glow_layer_;
+ cc::UIResourceId edge_resource_id_;
+ cc::UIResourceId glow_resource_id_;
+ gfx::Size edge_bitmap_size_;
+ gfx::Size glow_bitmap_size_;
DISALLOW_COPY_AND_ASSIGN(OverscrollGlow);
};

Powered by Google App Engine
This is Rietveld 408576698