Index: ui/gfx/compositor/layer_animation_observer.h |
diff --git a/ui/gfx/compositor/layer_animation_observer.h b/ui/gfx/compositor/layer_animation_observer.h |
index c35dc60cbae411a1cd1917d7647d295dba4ceb26..e3f45bbebd94c70be76a8cbe142cd1b2b6000b95 100644 |
--- a/ui/gfx/compositor/layer_animation_observer.h |
+++ b/ui/gfx/compositor/layer_animation_observer.h |
@@ -16,22 +16,29 @@ namespace ui { |
class LayerAnimationSequence; |
class ScopedLayerAnimationSettings; |
+class ImplicitAnimationObserver; |
// LayerAnimationObservers are notified when animations complete. |
class COMPOSITOR_EXPORT LayerAnimationObserver { |
public: |
// Called when the |sequence| ends. Not called if |sequence| is aborted. |
virtual void OnLayerAnimationEnded( |
- const LayerAnimationSequence* sequence) = 0; |
+ LayerAnimationSequence* sequence) = 0; |
// Called if |sequence| is aborted for any reason. Should never do anything |
// that may cause another animation to be started. |
virtual void OnLayerAnimationAborted( |
- const LayerAnimationSequence* sequence) = 0; |
+ LayerAnimationSequence* sequence) = 0; |
// Called when the animation is scheduled. |
virtual void OnLayerAnimationScheduled( |
- const LayerAnimationSequence* sequence) = 0; |
+ LayerAnimationSequence* sequence) = 0; |
+ |
+ protected: |
+ typedef std::set<LayerAnimationSequence*> AttachedSequences; |
+ |
+ LayerAnimationObserver(); |
+ virtual ~LayerAnimationObserver(); |
// If the animator is destroyed during an animation, the animations are |
// aborted. The resulting NotifyAborted notifications will NOT be sent to |
@@ -40,9 +47,15 @@ class COMPOSITOR_EXPORT LayerAnimationObserver { |
// OBSERVER WHEN YOU ARE DESTROYED. |
virtual bool RequiresNotificationWhenAnimatorDestroyed() const; |
- protected: |
- LayerAnimationObserver(); |
- virtual ~LayerAnimationObserver(); |
+ // Called when |this| is added to |sequence|'s observer list. |
+ virtual void OnAttachedToSequence(LayerAnimationSequence* sequence); |
+ |
+ // Called when |this| is removed to |sequence|'s observer list. |
+ virtual void OnDetachedFromSequence(LayerAnimationSequence* sequence); |
+ |
+ void DetachFromAllSequences(); |
sky
2012/01/30 22:20:19
Add a description of this. Maybe it should be name
|
+ |
+ AttachedSequences& attached_sequences() { return attached_sequences_; } |
sky
2012/01/30 22:20:19
I don't think you want subclasses modifying this.
|
private: |
friend class LayerAnimationSequence; |
@@ -53,7 +66,7 @@ class COMPOSITOR_EXPORT LayerAnimationObserver { |
// Called when |this| is removed to |sequence|'s observer list. |
void DetachedFromSequence(LayerAnimationSequence* sequence); |
- std::set<LayerAnimationSequence*> attached_sequences_; |
+ AttachedSequences attached_sequences_; |
}; |
// An implicit animation observer is intended to be used in conjunction with a |
@@ -67,29 +80,32 @@ class COMPOSITOR_EXPORT ImplicitAnimationObserver |
virtual void OnImplicitAnimationsCompleted() = 0; |
+ // Deactivates the observer and clears the collection of animations it is |
+ // waiting for. |
+ void StopObservingImplicitAnimations(); |
sky
2012/01/30 22:20:19
Can this be protected?
|
+ |
private: |
friend class ScopedLayerAnimationSettings; |
- // OnImplicitAnimationsCompleted is not fired unless the observer is active. |
- bool active() const { return active_; } |
- void SetActive(bool active); |
- |
// LayerAnimationObserver implementation |
virtual void OnLayerAnimationEnded( |
- const LayerAnimationSequence* sequence) OVERRIDE; |
+ LayerAnimationSequence* sequence) OVERRIDE; |
virtual void OnLayerAnimationAborted( |
- const LayerAnimationSequence* sequence) OVERRIDE; |
+ LayerAnimationSequence* sequence) OVERRIDE; |
virtual void OnLayerAnimationScheduled( |
- const LayerAnimationSequence* sequence) OVERRIDE; |
+ LayerAnimationSequence* sequence) OVERRIDE; |
+ virtual void OnAttachedToSequence( |
+ LayerAnimationSequence* sequence) OVERRIDE; |
+ virtual void OnDetachedFromSequence( |
+ LayerAnimationSequence* sequence) OVERRIDE; |
+ |
+ // OnImplicitAnimationsCompleted is not fired unless the observer is active. |
+ bool active() const { return active_; } |
+ void SetActive(bool active); |
void CheckCompleted(); |
bool active_; |
- |
- // This tracks the number of scheduled animations that have yet to complete. |
- // If this value is zero, and the observer is active, then |
- // OnImplicitAnimationsCompleted is fired. |
- size_t animation_count_; |
}; |
} // namespace ui |