| 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 25 matching lines...) Expand all Loading... |
| 36 LayerAnimationSequence* sequence) = 0; | 36 LayerAnimationSequence* sequence) = 0; |
| 37 | 37 |
| 38 protected: | 38 protected: |
| 39 typedef std::set<LayerAnimationSequence*> AttachedSequences; | 39 typedef std::set<LayerAnimationSequence*> AttachedSequences; |
| 40 | 40 |
| 41 LayerAnimationObserver(); | 41 LayerAnimationObserver(); |
| 42 virtual ~LayerAnimationObserver(); | 42 virtual ~LayerAnimationObserver(); |
| 43 | 43 |
| 44 // If the animator is destroyed during an animation, the animations are | 44 // If the animator is destroyed during an animation, the animations are |
| 45 // aborted. The resulting NotifyAborted notifications will NOT be sent to | 45 // aborted. The resulting NotifyAborted notifications will NOT be sent to |
| 46 // this observer if this function returns false. NOTE: IF YOU OVERRIDE THIS | 46 // this observer if this function returns false. NOTE: IF YOU override THIS |
| 47 // FUNCTION TO RETURN TRUE, YOU MUST REMEMBER TO REMOVE YOURSELF AS AN | 47 // FUNCTION TO RETURN TRUE, YOU MUST REMEMBER TO REMOVE YOURSELF AS AN |
| 48 // OBSERVER WHEN YOU ARE DESTROYED. | 48 // OBSERVER WHEN YOU ARE DESTROYED. |
| 49 virtual bool RequiresNotificationWhenAnimatorDestroyed() const; | 49 virtual bool RequiresNotificationWhenAnimatorDestroyed() const; |
| 50 | 50 |
| 51 // Called when |this| is added to |sequence|'s observer list. | 51 // Called when |this| is added to |sequence|'s observer list. |
| 52 virtual void OnAttachedToSequence(LayerAnimationSequence* sequence); | 52 virtual void OnAttachedToSequence(LayerAnimationSequence* sequence); |
| 53 | 53 |
| 54 // Called when |this| is removed to |sequence|'s observer list. | 54 // Called when |this| is removed to |sequence|'s observer list. |
| 55 virtual void OnDetachedFromSequence(LayerAnimationSequence* sequence); | 55 virtual void OnDetachedFromSequence(LayerAnimationSequence* sequence); |
| 56 | 56 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 virtual void OnLayerAnimationEnded( |
| 120 LayerAnimationSequence* sequence) OVERRIDE; | 120 LayerAnimationSequence* sequence) override; |
| 121 virtual void OnLayerAnimationAborted( | 121 virtual void OnLayerAnimationAborted( |
| 122 LayerAnimationSequence* sequence) OVERRIDE; | 122 LayerAnimationSequence* sequence) override; |
| 123 virtual void OnLayerAnimationScheduled( | 123 virtual void OnLayerAnimationScheduled( |
| 124 LayerAnimationSequence* sequence) OVERRIDE; | 124 LayerAnimationSequence* sequence) override; |
| 125 virtual void OnAttachedToSequence( | 125 virtual void OnAttachedToSequence( |
| 126 LayerAnimationSequence* sequence) OVERRIDE; | 126 LayerAnimationSequence* sequence) override; |
| 127 virtual void OnDetachedFromSequence( | 127 virtual void OnDetachedFromSequence( |
| 128 LayerAnimationSequence* sequence) OVERRIDE; | 128 LayerAnimationSequence* sequence) override; |
| 129 | 129 |
| 130 // OnImplicitAnimationsCompleted is not fired unless the observer is active. | 130 // OnImplicitAnimationsCompleted is not fired unless the observer is active. |
| 131 bool active() const { return active_; } | 131 bool active() const { return active_; } |
| 132 void SetActive(bool active); | 132 void SetActive(bool active); |
| 133 | 133 |
| 134 void CheckCompleted(); | 134 void CheckCompleted(); |
| 135 | 135 |
| 136 void UpdatePropertyAnimationStatus(LayerAnimationSequence* sequence, | 136 void UpdatePropertyAnimationStatus(LayerAnimationSequence* sequence, |
| 137 AnimationStatus status); | 137 AnimationStatus status); |
| 138 AnimationStatus AnimationStatusForProperty( | 138 AnimationStatus AnimationStatusForProperty( |
| 139 LayerAnimationElement::AnimatableProperty property) const; | 139 LayerAnimationElement::AnimatableProperty property) const; |
| 140 | 140 |
| 141 bool active_; | 141 bool active_; |
| 142 | 142 |
| 143 // Set to true in the destructor (if non-NULL). Used to detect deletion while | 143 // Set to true in the destructor (if non-NULL). Used to detect deletion while |
| 144 // calling out. | 144 // calling out. |
| 145 bool* destroyed_; | 145 bool* destroyed_; |
| 146 | 146 |
| 147 typedef std::map<LayerAnimationElement::AnimatableProperty, | 147 typedef std::map<LayerAnimationElement::AnimatableProperty, |
| 148 AnimationStatus> PropertyAnimationStatusMap; | 148 AnimationStatus> PropertyAnimationStatusMap; |
| 149 PropertyAnimationStatusMap property_animation_status_; | 149 PropertyAnimationStatusMap property_animation_status_; |
| 150 | 150 |
| 151 // True if OnLayerAnimationScheduled() has been called at least once. | 151 // True if OnLayerAnimationScheduled() has been called at least once. |
| 152 bool first_sequence_scheduled_; | 152 bool first_sequence_scheduled_; |
| 153 }; | 153 }; |
| 154 | 154 |
| 155 } // namespace ui | 155 } // namespace ui |
| 156 | 156 |
| 157 #endif // UI_COMPOSITOR_LAYER_ANIMATION_OBSERVER_H_ | 157 #endif // UI_COMPOSITOR_LAYER_ANIMATION_OBSERVER_H_ |
| OLD | NEW |