| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ | 5 #ifndef CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ |
| 6 #define CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ | 6 #define CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 AnimationEventsVector* events); | 58 AnimationEventsVector* events); |
| 59 | 59 |
| 60 void UpdateState(bool start_ready_animations, | 60 void UpdateState(bool start_ready_animations, |
| 61 AnimationEventsVector* events); | 61 AnimationEventsVector* events); |
| 62 | 62 |
| 63 // Make animations affect active observers if and only if they affect | 63 // Make animations affect active observers if and only if they affect |
| 64 // pending observers. Any animations that no longer affect any observers | 64 // pending observers. Any animations that no longer affect any observers |
| 65 // are deleted. | 65 // are deleted. |
| 66 void ActivateAnimations(); | 66 void ActivateAnimations(); |
| 67 | 67 |
| 68 // Returns the active animation in the given group, animating the given | |
| 69 // property, if such an animation exists. | |
| 70 Animation* GetAnimation(int group_id, | |
| 71 Animation::TargetProperty target_property) const; | |
| 72 | |
| 73 // Returns the active animation animating the given property that is either | 68 // Returns the active animation animating the given property that is either |
| 74 // running, or is next to run, if such an animation exists. | 69 // running, or is next to run, if such an animation exists. |
| 75 Animation* GetAnimation(Animation::TargetProperty target_property) const; | 70 Animation* GetAnimation(Animation::TargetProperty target_property) const; |
| 76 | 71 |
| 72 // Returns the active animation for the given unique animation id. |
| 73 Animation* GetAnimationById(int animation_id) const; |
| 74 |
| 77 // Returns true if there are any animations that have neither finished nor | 75 // Returns true if there are any animations that have neither finished nor |
| 78 // aborted. | 76 // aborted. |
| 79 bool HasActiveAnimation() const; | 77 bool HasActiveAnimation() const; |
| 80 | 78 |
| 81 // Returns true if there are any animations at all to process. | 79 // Returns true if there are any animations at all to process. |
| 82 bool has_any_animation() const { return !animations_.empty(); } | 80 bool has_any_animation() const { return !animations_.empty(); } |
| 83 | 81 |
| 84 // Returns true if there is an animation currently animating the given | 82 // Returns true if there is an animation currently animating the given |
| 85 // property, or if there is an animation scheduled to animate this property in | 83 // property, or if there is an animation scheduled to animate this property in |
| 86 // the future. | 84 // the future. |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 void NotifyObserversFilterAnimated(const FilterOperations& filter, | 184 void NotifyObserversFilterAnimated(const FilterOperations& filter, |
| 187 bool notify_active_observers, | 185 bool notify_active_observers, |
| 188 bool notify_pending_observers); | 186 bool notify_pending_observers); |
| 189 void NotifyObserversScrollOffsetAnimated( | 187 void NotifyObserversScrollOffsetAnimated( |
| 190 const gfx::ScrollOffset& scroll_offset, | 188 const gfx::ScrollOffset& scroll_offset, |
| 191 bool notify_active_observers, | 189 bool notify_active_observers, |
| 192 bool notify_pending_observers); | 190 bool notify_pending_observers); |
| 193 | 191 |
| 194 void NotifyObserversAnimationWaitingForDeletion(); | 192 void NotifyObserversAnimationWaitingForDeletion(); |
| 195 | 193 |
| 194 void NotifyObserversScrollOffsetAnimationRemoved(); |
| 195 |
| 196 bool HasValueObserver(); | 196 bool HasValueObserver(); |
| 197 bool HasActiveValueObserver(); | 197 bool HasActiveValueObserver(); |
| 198 | 198 |
| 199 AnimationRegistrar* registrar_; | 199 AnimationRegistrar* registrar_; |
| 200 int id_; | 200 int id_; |
| 201 ScopedPtrVector<Animation> animations_; | 201 ScopedPtrVector<Animation> animations_; |
| 202 | 202 |
| 203 // This is used to ensure that we don't spam the registrar. | 203 // This is used to ensure that we don't spam the registrar. |
| 204 bool is_active_; | 204 bool is_active_; |
| 205 | 205 |
| 206 base::TimeTicks last_tick_time_; | 206 base::TimeTicks last_tick_time_; |
| 207 | 207 |
| 208 ObserverList<LayerAnimationValueObserver> value_observers_; | 208 ObserverList<LayerAnimationValueObserver> value_observers_; |
| 209 ObserverList<LayerAnimationEventObserver> event_observers_; | 209 ObserverList<LayerAnimationEventObserver> event_observers_; |
| 210 | 210 |
| 211 LayerAnimationValueProvider* value_provider_; | 211 LayerAnimationValueProvider* value_provider_; |
| 212 | 212 |
| 213 AnimationDelegate* layer_animation_delegate_; | 213 AnimationDelegate* layer_animation_delegate_; |
| 214 | 214 |
| 215 // Only try to start animations when new animations are added or when the | 215 // Only try to start animations when new animations are added or when the |
| 216 // previous attempt at starting animations failed to start all animations. | 216 // previous attempt at starting animations failed to start all animations. |
| 217 bool needs_to_start_animations_; | 217 bool needs_to_start_animations_; |
| 218 | 218 |
| 219 DISALLOW_COPY_AND_ASSIGN(LayerAnimationController); | 219 DISALLOW_COPY_AND_ASSIGN(LayerAnimationController); |
| 220 }; | 220 }; |
| 221 | 221 |
| 222 } // namespace cc | 222 } // namespace cc |
| 223 | 223 |
| 224 #endif // CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ | 224 #endif // CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ |
| OLD | NEW |