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

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: merge with master 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..8f377840107c4c790c51c9842b4c7e190286415b 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,6 +69,14 @@ 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);
+
+ // Notifies the observers that this sequence has ended.
+ void NotifyEnded();
+
private:
typedef std::vector<linked_ptr<LayerAnimationElement> > Elements;
@@ -86,6 +96,9 @@ class COMPOSITOR_EXPORT LayerAnimationSequence {
size_t last_element_;
base::TimeDelta last_start_;
+ // These parties are notified when layer animations end.
+ ObserverList<LayerAnimationObserver> observers_;
+
DISALLOW_COPY_AND_ASSIGN(LayerAnimationSequence);
};

Powered by Google App Engine
This is Rietveld 408576698