Index: cc/animation/animation_player.h |
diff --git a/cc/animation/animation_player.h b/cc/animation/animation_player.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..49316683057c5ca740fdb7e9a35ca1905e401c97 |
--- /dev/null |
+++ b/cc/animation/animation_player.h |
@@ -0,0 +1,106 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CC_ANIMATION_ANIMATION_PLAYER_H_ |
+#define CC_ANIMATION_ANIMATION_PLAYER_H_ |
+ |
+#include "base/memory/ref_counted.h" |
+#include "cc/animation/layer_animation_controller.h" |
+#include "cc/animation/layer_animation_value_observer.h" |
+#include "cc/animation/layer_animation_value_provider.h" |
+#include "cc/base/cc_export.h" |
+ |
+namespace gfx { |
+class ScrollOffset; |
+class Transform; |
+} |
+ |
+namespace cc { |
+ |
+class AnimationHost; |
+class AnimationTimeline; |
+class FilterOperations; |
+class Layer; |
+ |
+class CC_EXPORT AnimationPlayer : public base::RefCounted<AnimationPlayer>, |
+ public LayerAnimationValueProvider { |
+ public: |
+ static scoped_refptr<AnimationPlayer> Create(int id); |
+ scoped_refptr<AnimationPlayer> CreateImplInstance() const; |
+ |
+ int id() const { return id_; } |
+ int layer_id() const { return layer_id_; } |
+ |
+ AnimationHost* animation_host() { return animation_host_; } |
+ const AnimationHost* animation_host() const { return animation_host_; } |
+ void SetAnimationHost(AnimationHost* animation_host); |
+ |
+ AnimationTimeline* animation_timeline() { return animation_timeline_; } |
+ const AnimationTimeline* animation_timeline() const { |
+ return animation_timeline_; |
+ } |
+ void SetAnimationTimeline(AnimationTimeline* timeline); |
+ |
+ LayerAnimationController* layer_animation_controller() const { |
+ return layer_animation_controller_.get(); |
+ } |
+ |
+ void set_layer_animation_delegate(AnimationDelegate* delegate); |
+ |
+ void AttachLayer(int layer_id); |
+ void DetachLayer(); |
+ |
+ void LayerImplRegistered(int layer_id, bool is_active_tree); |
+ void LayerImplUnregistered(int layer_id, bool is_active_tree); |
+ |
+ void AddAnimation(scoped_ptr<Animation> animation); |
+ void PauseAnimation(int animation_id, double time_offset); |
+ void RemoveAnimation(int animation_id); |
+ |
+ void PushPropertiesTo(AnimationPlayer* player_impl); |
+ |
+ private: |
+ friend class base::RefCounted<AnimationPlayer>; |
+ |
+ explicit AnimationPlayer(int id); |
+ ~AnimationPlayer() override; |
+ |
+ void SetNeedsCommit(); |
+ |
+ void SetFilterMutated(bool active_tree, const FilterOperations& filters); |
+ void SetOpacityMutated(bool active_tree, float opacity); |
+ void SetTransformMutated(bool active_tree, const gfx::Transform& transform); |
+ void SetScrollOffsetMutated(bool active_tree, |
+ const gfx::ScrollOffset& scroll_offset); |
+ |
+ void AddControllerToTimeline(); |
+ void RemoveControllerFromTimeline(); |
+ |
+ void CreateActiveValueObserver(); |
+ void DestroyActiveValueObserver(); |
+ |
+ void CreatePendingValueObserver(); |
+ void DestroyPendingValueObserver(); |
+ |
+ // LayerAnimationValueProvider implementation. |
+ gfx::ScrollOffset ScrollOffsetForAnimation() const override; |
+ |
+ class ValueObserver; |
+ scoped_ptr<ValueObserver> active_value_observer_; |
+ scoped_ptr<ValueObserver> pending_value_observer_; |
+ |
+ scoped_refptr<LayerAnimationController> layer_animation_controller_; |
+ AnimationHost* animation_host_; |
+ AnimationTimeline* animation_timeline_; |
+ AnimationDelegate* layer_animation_delegate_; |
+ |
+ int id_; |
+ int layer_id_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(AnimationPlayer); |
+}; |
+ |
+} // namespace cc |
+ |
+#endif // CC_ANIMATION_ANIMATION_PLAYER_H_ |