Index: ui/compositor/layer_animator.h |
diff --git a/ui/compositor/layer_animator.h b/ui/compositor/layer_animator.h |
index 99b3765b518484e6aa29c698a5fee75264fe8444..1c92ac0f14c6c9c2938598eb2a4481146433a532 100644 |
--- a/ui/compositor/layer_animator.h |
+++ b/ui/compositor/layer_animator.h |
@@ -14,10 +14,15 @@ |
#include "base/memory/ref_counted.h" |
#include "base/observer_list.h" |
#include "base/time/time.h" |
+#include "cc/animation/layer_animation_event_observer.h" |
#include "ui/compositor/compositor_export.h" |
#include "ui/compositor/layer_animation_element.h" |
#include "ui/gfx/animation/tween.h" |
+namespace cc { |
+class Layer; |
+} |
+ |
namespace gfx { |
class Animation; |
class Rect; |
@@ -41,7 +46,9 @@ class ScopedLayerAnimationSettings; |
// ensure that it is not disposed of until it finishes executing. It does this |
// by holding a reference to itself for the duration of methods for which it |
// must guarantee that |this| is valid. |
-class COMPOSITOR_EXPORT LayerAnimator : public base::RefCounted<LayerAnimator> { |
+class COMPOSITOR_EXPORT LayerAnimator |
+ : public base::RefCounted<LayerAnimator>, |
+ NON_EXPORTED_BASE(public cc::LayerAnimationEventObserver) { |
public: |
enum PreemptionStrategy { |
IMMEDIATELY_SET_NEW_TARGET, |
@@ -97,6 +104,9 @@ class COMPOSITOR_EXPORT LayerAnimator : public base::RefCounted<LayerAnimator> { |
// a valid delegate installed. |
void SetDelegate(LayerAnimationDelegate* delegate); |
+ // Unsubscribe from |cc_layer_| and subscribe to |new_layer|. |
+ void SwitchToLayer(scoped_refptr<cc::Layer> new_layer); |
+ |
// Sets the animation preemption strategy. This determines the behaviour if |
// a property is set during an animation. The default is |
// IMMEDIATELY_SET_NEW_TARGET (see ImmediatelySetNewTarget below). |
@@ -193,7 +203,7 @@ class COMPOSITOR_EXPORT LayerAnimator : public base::RefCounted<LayerAnimator> { |
void RemoveFromCollection(LayerAnimatorCollection* collection); |
protected: |
- virtual ~LayerAnimator(); |
+ ~LayerAnimator() override; |
LayerAnimationDelegate* delegate() { return delegate_; } |
const LayerAnimationDelegate* delegate() const { return delegate_; } |
@@ -311,6 +321,9 @@ class COMPOSITOR_EXPORT LayerAnimator : public base::RefCounted<LayerAnimator> { |
LayerAnimatorCollection* GetLayerAnimatorCollection(); |
+ // LayerAnimationEventObserver |
+ void OnAnimationStarted(const cc::AnimationEvent& event) override; |
+ |
// This is the queue of animations to run. |
AnimationQueue animation_queue_; |