Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CC_ANIMATION_ANIMATION_PLAYER_H_ | |
| 6 #define CC_ANIMATION_ANIMATION_PLAYER_H_ | |
| 7 | |
| 8 #include "base/memory/ref_counted.h" | |
| 9 #include "cc/animation/layer_animation_controller.h" | |
| 10 #include "cc/animation/layer_animation_value_observer.h" | |
| 11 #include "cc/animation/layer_animation_value_provider.h" | |
| 12 #include "cc/base/cc_export.h" | |
| 13 | |
| 14 namespace cc { | |
| 15 | |
| 16 class AnimationTimeline; | |
| 17 class Layer; | |
| 18 | |
| 19 class CC_EXPORT AnimationPlayer : public base::RefCounted<AnimationPlayer>, | |
| 20 public LayerAnimationValueProvider { | |
| 21 public: | |
| 22 static scoped_refptr<AnimationPlayer> Create(int id); | |
| 23 scoped_refptr<AnimationPlayer> CreateImplInstance() const; | |
| 24 | |
| 25 int id() const { return id_; } | |
| 26 | |
| 27 AnimationTimeline* animation_timeline() { return animation_timeline_; } | |
| 28 const AnimationTimeline* animation_timeline() const { | |
| 29 return animation_timeline_; | |
| 30 } | |
| 31 void SetAnimationTimeline(AnimationTimeline* timeline); | |
| 32 | |
| 33 LayerAnimationController* layer_animation_controller() const { | |
| 34 return layer_animation_controller_.get(); | |
| 35 } | |
| 36 | |
| 37 void set_layer_animation_delegate(AnimationDelegate* delegate); | |
|
Ian Vollick
2015/05/05 03:52:06
Will we need to plumb back animation start times o
| |
| 38 | |
| 39 void AttachLayer(int layer_id); | |
| 40 void DetachLayer(); | |
| 41 | |
| 42 void LayerImplRegistered(int layer_id, bool is_active_tree); | |
| 43 void LayerImplUnregistered(int layer_id, bool is_active_tree); | |
| 44 | |
| 45 void AddAnimation(scoped_ptr<Animation> animation); | |
| 46 void PauseAnimation(int animation_id, double time_offset); | |
| 47 void RemoveAnimation(int animation_id); | |
| 48 | |
| 49 void PushPropertiesTo(AnimationPlayer* player_impl); | |
| 50 | |
| 51 private: | |
| 52 friend class base::RefCounted<AnimationPlayer>; | |
| 53 friend class AnimationPlayerPendingValueObserver; | |
| 54 | |
| 55 explicit AnimationPlayer(int id); | |
| 56 ~AnimationPlayer() override; | |
| 57 | |
| 58 void SetNeedsCommit(); | |
| 59 | |
| 60 void SetFilterMutated(bool active_tree, const FilterOperations& filters); | |
| 61 void SetOpacityMutated(bool active_tree, float opacity); | |
| 62 void SetTransformMutated(bool active_tree, const gfx::Transform& transform); | |
| 63 | |
| 64 void CreateActiveValueObserver(); | |
| 65 void DestroyActiveValueObserver(); | |
| 66 | |
| 67 void CreatePendingValueObserver(); | |
| 68 void DestroyPendingValueObserver(); | |
| 69 | |
| 70 // LayerAnimationValueProvider implementation. | |
| 71 gfx::ScrollOffset ScrollOffsetForAnimation() const override; | |
| 72 | |
| 73 class ValueObserver; | |
| 74 scoped_ptr<ValueObserver> active_value_observer_; | |
| 75 scoped_ptr<ValueObserver> pending_value_observer_; | |
| 76 | |
| 77 scoped_refptr<LayerAnimationController> layer_animation_controller_; | |
| 78 AnimationTimeline* animation_timeline_; | |
| 79 AnimationDelegate* layer_animation_delegate_; | |
| 80 | |
| 81 int id_; | |
| 82 int layer_id_; | |
| 83 | |
| 84 DISALLOW_COPY_AND_ASSIGN(AnimationPlayer); | |
| 85 }; | |
| 86 | |
| 87 } // namespace cc | |
| 88 | |
| 89 #endif // CC_ANIMATION_ANIMATION_PLAYER_H_ | |
| OLD | NEW |