Index: ui/gfx/compositor/layer.h |
diff --git a/ui/gfx/compositor/layer.h b/ui/gfx/compositor/layer.h |
index d523c9cf6e7de57acec60f623992d1a889ed0459..7679ca2524de3177394e858d1754e20606a2b532 100644 |
--- a/ui/gfx/compositor/layer.h |
+++ b/ui/gfx/compositor/layer.h |
@@ -9,6 +9,7 @@ |
#include <vector> |
#include "base/memory/ref_counted.h" |
+#include "base/observer_list.h" |
#include "ui/gfx/rect.h" |
#include "ui/gfx/transform.h" |
#include "ui/gfx/compositor/compositor.h" |
@@ -18,6 +19,7 @@ class SkCanvas; |
namespace ui { |
class Compositor; |
+class LayerObserver; |
class Texture; |
// Layer manages a texture, transform and a set of child Layers. Any View that |
@@ -79,6 +81,11 @@ class COMPOSITOR_EXPORT Layer { |
// Resets the canvas of the texture. |
void SetCanvas(const SkCanvas& canvas, const gfx::Point& origin); |
+ // Layers do not own observers. It is the responsibility of the observer to |
+ // remove itself when it is done observing. |
+ void AddObserver(LayerObserver* observer); |
+ void RemoveObserver(LayerObserver* observer); |
+ |
// Draws the layer with hole if hole is non empty. |
// hole looks like: |
// |
@@ -134,6 +141,8 @@ class COMPOSITOR_EXPORT Layer { |
gfx::Rect hole_rect_; |
+ ObserverList<LayerObserver> observer_list_; |
+ |
DISALLOW_COPY_AND_ASSIGN(Layer); |
}; |