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

Unified Diff: ui/gfx/compositor/layer_animation_sequence.h

Issue 8395046: Allows observers to be notified when layer animations complete. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address reviewer comments. Created 9 years, 2 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
Index: ui/gfx/compositor/layer_animation_sequence.h
diff --git a/ui/gfx/compositor/layer_animation_sequence.h b/ui/gfx/compositor/layer_animation_sequence.h
index 4670587880cfd7a6e2316ced81138095f4f56524..6441a41a75b8da2add7639ecaeedabb23a8235ea 100644
--- a/ui/gfx/compositor/layer_animation_sequence.h
+++ b/ui/gfx/compositor/layer_animation_sequence.h
@@ -9,6 +9,7 @@
#include <vector>
#include "base/memory/linked_ptr.h"
+#include "base/observer_list.h"
#include "base/time.h"
#include "ui/gfx/compositor/compositor_export.h"
#include "ui/gfx/compositor/layer_animation_element.h"
@@ -16,6 +17,7 @@
namespace ui {
class LayerAnimationDelegate;
+class LayerAnimationObserver;
// Contains a collection of layer animation elements to be played one after
// another. Although it has a similar interface to LayerAnimationElement, it is
@@ -67,9 +69,26 @@ class COMPOSITOR_EXPORT LayerAnimationSequence {
bool HasCommonProperty(
const LayerAnimationElement::AnimatableProperties& other) const;
+ // These functions are used for adding or removing observers from the observer
+ // list. The observers are notified when animations end.
+ void AddObserver(LayerAnimationObserver* observer);
+ void RemoveObserver(LayerAnimationObserver* observer);
+
+ // Called when the animator schedules this sequence.
+ void OnScheduled();
+
private:
typedef std::vector<linked_ptr<LayerAnimationElement> > Elements;
+ // Notifies the observers that this sequence has been scheduled.
+ void NotifyScheduled();
+
+ // Notifies the observers that this sequence has ended.
+ void NotifyEnded();
+
+ // Notifies the observers that this sequence has been aborted.
+ void NotifyAborted();
+
// The sum of the durations of all the elements in the sequence.
base::TimeDelta duration_;
@@ -86,6 +105,9 @@ class COMPOSITOR_EXPORT LayerAnimationSequence {
size_t last_element_;
base::TimeDelta last_start_;
+ // These parties are notified when layer animations end.
sky 2011/10/28 22:11:38 parties -> observers
+ ObserverList<LayerAnimationObserver> observers_;
+
DISALLOW_COPY_AND_ASSIGN(LayerAnimationSequence);
};

Powered by Google App Engine
This is Rietveld 408576698