| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_COMPOSITOR_LAYER_ANIMATION_OBSERVER_H_ | 5 #ifndef UI_COMPOSITOR_LAYER_ANIMATION_OBSERVER_H_ |
| 6 #define UI_COMPOSITOR_LAYER_ANIMATION_OBSERVER_H_ | 6 #define UI_COMPOSITOR_LAYER_ANIMATION_OBSERVER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 AttachedSequences attached_sequences_; | 75 AttachedSequences attached_sequences_; |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 // An implicit animation observer is intended to be used in conjunction with a | 78 // An implicit animation observer is intended to be used in conjunction with a |
| 79 // ScopedLayerAnimationSettings object in order to receive a notification when | 79 // ScopedLayerAnimationSettings object in order to receive a notification when |
| 80 // all implicit animations complete. | 80 // all implicit animations complete. |
| 81 class COMPOSITOR_EXPORT ImplicitAnimationObserver | 81 class COMPOSITOR_EXPORT ImplicitAnimationObserver |
| 82 : public LayerAnimationObserver { | 82 : public LayerAnimationObserver { |
| 83 public: | 83 public: |
| 84 ImplicitAnimationObserver(); | 84 ImplicitAnimationObserver(); |
| 85 virtual ~ImplicitAnimationObserver(); | 85 ~ImplicitAnimationObserver() override; |
| 86 | 86 |
| 87 // Called when the first animation sequence has started. | 87 // Called when the first animation sequence has started. |
| 88 virtual void OnImplicitAnimationsScheduled() {} | 88 virtual void OnImplicitAnimationsScheduled() {} |
| 89 | 89 |
| 90 virtual void OnImplicitAnimationsCompleted() = 0; | 90 virtual void OnImplicitAnimationsCompleted() = 0; |
| 91 | 91 |
| 92 protected: | 92 protected: |
| 93 // Deactivates the observer and clears the collection of animations it is | 93 // Deactivates the observer and clears the collection of animations it is |
| 94 // waiting for. | 94 // waiting for. |
| 95 void StopObservingImplicitAnimations(); | 95 void StopObservingImplicitAnimations(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 109 private: | 109 private: |
| 110 enum AnimationStatus { | 110 enum AnimationStatus { |
| 111 ANIMATION_STATUS_UNKNOWN, | 111 ANIMATION_STATUS_UNKNOWN, |
| 112 ANIMATION_STATUS_COMPLETED, | 112 ANIMATION_STATUS_COMPLETED, |
| 113 ANIMATION_STATUS_ABORTED, | 113 ANIMATION_STATUS_ABORTED, |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 friend class ScopedLayerAnimationSettings; | 116 friend class ScopedLayerAnimationSettings; |
| 117 | 117 |
| 118 // LayerAnimationObserver implementation | 118 // LayerAnimationObserver implementation |
| 119 virtual void OnLayerAnimationEnded( | 119 void OnLayerAnimationEnded(LayerAnimationSequence* sequence) override; |
| 120 LayerAnimationSequence* sequence) override; | 120 void OnLayerAnimationAborted(LayerAnimationSequence* sequence) override; |
| 121 virtual void OnLayerAnimationAborted( | 121 void OnLayerAnimationScheduled(LayerAnimationSequence* sequence) override; |
| 122 LayerAnimationSequence* sequence) override; | 122 void OnAttachedToSequence(LayerAnimationSequence* sequence) override; |
| 123 virtual void OnLayerAnimationScheduled( | 123 void OnDetachedFromSequence(LayerAnimationSequence* sequence) override; |
| 124 LayerAnimationSequence* sequence) override; | |
| 125 virtual void OnAttachedToSequence( | |
| 126 LayerAnimationSequence* sequence) override; | |
| 127 virtual void OnDetachedFromSequence( | |
| 128 LayerAnimationSequence* sequence) override; | |
| 129 | 124 |
| 130 // OnImplicitAnimationsCompleted is not fired unless the observer is active. | 125 // OnImplicitAnimationsCompleted is not fired unless the observer is active. |
| 131 bool active() const { return active_; } | 126 bool active() const { return active_; } |
| 132 void SetActive(bool active); | 127 void SetActive(bool active); |
| 133 | 128 |
| 134 void CheckCompleted(); | 129 void CheckCompleted(); |
| 135 | 130 |
| 136 void UpdatePropertyAnimationStatus(LayerAnimationSequence* sequence, | 131 void UpdatePropertyAnimationStatus(LayerAnimationSequence* sequence, |
| 137 AnimationStatus status); | 132 AnimationStatus status); |
| 138 AnimationStatus AnimationStatusForProperty( | 133 AnimationStatus AnimationStatusForProperty( |
| 139 LayerAnimationElement::AnimatableProperty property) const; | 134 LayerAnimationElement::AnimatableProperty property) const; |
| 140 | 135 |
| 141 bool active_; | 136 bool active_; |
| 142 | 137 |
| 143 // Set to true in the destructor (if non-NULL). Used to detect deletion while | 138 // Set to true in the destructor (if non-NULL). Used to detect deletion while |
| 144 // calling out. | 139 // calling out. |
| 145 bool* destroyed_; | 140 bool* destroyed_; |
| 146 | 141 |
| 147 typedef std::map<LayerAnimationElement::AnimatableProperty, | 142 typedef std::map<LayerAnimationElement::AnimatableProperty, |
| 148 AnimationStatus> PropertyAnimationStatusMap; | 143 AnimationStatus> PropertyAnimationStatusMap; |
| 149 PropertyAnimationStatusMap property_animation_status_; | 144 PropertyAnimationStatusMap property_animation_status_; |
| 150 | 145 |
| 151 // True if OnLayerAnimationScheduled() has been called at least once. | 146 // True if OnLayerAnimationScheduled() has been called at least once. |
| 152 bool first_sequence_scheduled_; | 147 bool first_sequence_scheduled_; |
| 153 }; | 148 }; |
| 154 | 149 |
| 155 } // namespace ui | 150 } // namespace ui |
| 156 | 151 |
| 157 #endif // UI_COMPOSITOR_LAYER_ANIMATION_OBSERVER_H_ | 152 #endif // UI_COMPOSITOR_LAYER_ANIMATION_OBSERVER_H_ |
| OLD | NEW |