| 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_ANIMATOR_H_ | 5 #ifndef UI_COMPOSITOR_LAYER_ANIMATOR_H_ |
| 6 #define UI_COMPOSITOR_LAYER_ANIMATOR_H_ | 6 #define UI_COMPOSITOR_LAYER_ANIMATOR_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <deque> | 9 #include <deque> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 | 137 |
| 138 // When set to true, all animations complete immediately. | 138 // When set to true, all animations complete immediately. |
| 139 static void set_disable_animations_for_test(bool disable_animations) { | 139 static void set_disable_animations_for_test(bool disable_animations) { |
| 140 disable_animations_for_test_ = disable_animations; | 140 disable_animations_for_test_ = disable_animations; |
| 141 } | 141 } |
| 142 | 142 |
| 143 static bool disable_animations_for_test() { | 143 static bool disable_animations_for_test() { |
| 144 return disable_animations_for_test_; | 144 return disable_animations_for_test_; |
| 145 } | 145 } |
| 146 | 146 |
| 147 // Set |time_scale| > 1 to slow down animations for visual testing. |
| 148 static void set_time_scale_for_test(int time_scale) { |
| 149 time_scale_for_test_ = time_scale; |
| 150 } |
| 151 |
| 147 protected: | 152 protected: |
| 148 LayerAnimationDelegate* delegate() { return delegate_; } | 153 LayerAnimationDelegate* delegate() { return delegate_; } |
| 149 const LayerAnimationDelegate* delegate() const { return delegate_; } | 154 const LayerAnimationDelegate* delegate() const { return delegate_; } |
| 150 | 155 |
| 151 // Virtual for testing. | 156 // Virtual for testing. |
| 152 virtual bool ProgressAnimation(LayerAnimationSequence* sequence, | 157 virtual bool ProgressAnimation(LayerAnimationSequence* sequence, |
| 153 base::TimeDelta delta); | 158 base::TimeDelta delta); |
| 154 | 159 |
| 155 // Returns true if the sequence is owned by this animator. | 160 // Returns true if the sequence is owned by this animator. |
| 156 bool HasAnimation(LayerAnimationSequence* sequence) const; | 161 bool HasAnimation(LayerAnimationSequence* sequence) const; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 // True if we are being stepped by our container. | 269 // True if we are being stepped by our container. |
| 265 bool is_started_; | 270 bool is_started_; |
| 266 | 271 |
| 267 // This prevents the animator from automatically stepping through animations | 272 // This prevents the animator from automatically stepping through animations |
| 268 // and allows for manual stepping. | 273 // and allows for manual stepping. |
| 269 bool disable_timer_for_test_; | 274 bool disable_timer_for_test_; |
| 270 | 275 |
| 271 // This causes all animations to complete immediately. | 276 // This causes all animations to complete immediately. |
| 272 static bool disable_animations_for_test_; | 277 static bool disable_animations_for_test_; |
| 273 | 278 |
| 279 // Scales all animation durations by this factor. |
| 280 static int time_scale_for_test_; |
| 281 |
| 274 // Observers are notified when layer animations end, are scheduled or are | 282 // Observers are notified when layer animations end, are scheduled or are |
| 275 // aborted. | 283 // aborted. |
| 276 ObserverList<LayerAnimationObserver> observers_; | 284 ObserverList<LayerAnimationObserver> observers_; |
| 277 | 285 |
| 278 DISALLOW_COPY_AND_ASSIGN(LayerAnimator); | 286 DISALLOW_COPY_AND_ASSIGN(LayerAnimator); |
| 279 }; | 287 }; |
| 280 | 288 |
| 281 } // namespace ui | 289 } // namespace ui |
| 282 | 290 |
| 283 #endif // UI_COMPOSITOR_LAYER_ANIMATOR_H_ | 291 #endif // UI_COMPOSITOR_LAYER_ANIMATOR_H_ |
| OLD | NEW |