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 gfx { |
| 15 class ScrollOffset; |
| 16 class Transform; |
| 17 } |
| 18 |
| 19 namespace cc { |
| 20 |
| 21 class AnimationHost; |
| 22 class AnimationTimeline; |
| 23 class FilterOperations; |
| 24 class Layer; |
| 25 |
| 26 class CC_EXPORT AnimationPlayer : public base::RefCounted<AnimationPlayer>, |
| 27 public LayerAnimationValueProvider { |
| 28 public: |
| 29 static scoped_refptr<AnimationPlayer> Create(int id); |
| 30 scoped_refptr<AnimationPlayer> CreateImplInstance() const; |
| 31 |
| 32 int id() const { return id_; } |
| 33 int layer_id() const { return layer_id_; } |
| 34 |
| 35 AnimationHost* animation_host() { return animation_host_; } |
| 36 const AnimationHost* animation_host() const { return animation_host_; } |
| 37 void SetAnimationHost(AnimationHost* animation_host); |
| 38 |
| 39 AnimationTimeline* animation_timeline() { return animation_timeline_; } |
| 40 const AnimationTimeline* animation_timeline() const { |
| 41 return animation_timeline_; |
| 42 } |
| 43 void SetAnimationTimeline(AnimationTimeline* timeline); |
| 44 |
| 45 LayerAnimationController* layer_animation_controller() const { |
| 46 return layer_animation_controller_.get(); |
| 47 } |
| 48 |
| 49 void set_layer_animation_delegate(AnimationDelegate* delegate); |
| 50 |
| 51 void AttachLayer(int layer_id); |
| 52 void DetachLayer(); |
| 53 |
| 54 void LayerRegistered(int layer_id, bool is_active_tree); |
| 55 void LayerUnregistered(int layer_id, bool is_active_tree); |
| 56 |
| 57 void AddAnimation(scoped_ptr<Animation> animation); |
| 58 void PauseAnimation(int animation_id, double time_offset); |
| 59 void RemoveAnimation(int animation_id); |
| 60 |
| 61 void PushPropertiesTo(AnimationPlayer* player_impl); |
| 62 |
| 63 bool has_active_value_observer_for_testing() const { |
| 64 return active_value_observer_; |
| 65 } |
| 66 bool has_pending_value_observer_for_testing() const { |
| 67 return pending_value_observer_; |
| 68 } |
| 69 |
| 70 private: |
| 71 friend class base::RefCounted<AnimationPlayer>; |
| 72 |
| 73 explicit AnimationPlayer(int id); |
| 74 ~AnimationPlayer() override; |
| 75 |
| 76 void SetNeedsCommit(); |
| 77 |
| 78 void SetFilterMutated(bool active_tree, const FilterOperations& filters); |
| 79 void SetOpacityMutated(bool active_tree, float opacity); |
| 80 void SetTransformMutated(bool active_tree, const gfx::Transform& transform); |
| 81 void SetScrollOffsetMutated(bool active_tree, |
| 82 const gfx::ScrollOffset& scroll_offset); |
| 83 |
| 84 void AddControllerToTimeline(); |
| 85 void RemoveControllerFromTimeline(); |
| 86 |
| 87 void CreateActiveValueObserver(); |
| 88 void DestroyActiveValueObserver(); |
| 89 |
| 90 void CreatePendingValueObserver(); |
| 91 void DestroyPendingValueObserver(); |
| 92 |
| 93 // LayerAnimationValueProvider implementation. |
| 94 gfx::ScrollOffset ScrollOffsetForAnimation() const override; |
| 95 |
| 96 class ValueObserver; |
| 97 scoped_ptr<ValueObserver> active_value_observer_; |
| 98 scoped_ptr<ValueObserver> pending_value_observer_; |
| 99 |
| 100 scoped_refptr<LayerAnimationController> layer_animation_controller_; |
| 101 AnimationHost* animation_host_; |
| 102 AnimationTimeline* animation_timeline_; |
| 103 AnimationDelegate* layer_animation_delegate_; |
| 104 |
| 105 int id_; |
| 106 int layer_id_; |
| 107 |
| 108 DISALLOW_COPY_AND_ASSIGN(AnimationPlayer); |
| 109 }; |
| 110 |
| 111 } // namespace cc |
| 112 |
| 113 #endif // CC_ANIMATION_ANIMATION_PLAYER_H_ |
OLD | NEW |