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 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 class Rect; | 22 class Rect; |
23 class Transform; | 23 class Transform; |
24 } | 24 } |
25 | 25 |
26 namespace ui { | 26 namespace ui { |
27 class Animation; | 27 class Animation; |
28 class Layer; | 28 class Layer; |
29 class LayerAnimationSequence; | 29 class LayerAnimationSequence; |
30 class LayerAnimationDelegate; | 30 class LayerAnimationDelegate; |
31 class LayerAnimationObserver; | 31 class LayerAnimationObserver; |
| 32 class LayerAnimationTimer; |
32 class ScopedLayerAnimationSettings; | 33 class ScopedLayerAnimationSettings; |
33 | 34 |
34 // When a property of layer needs to be changed it is set by way of | 35 // When a property of layer needs to be changed it is set by way of |
35 // LayerAnimator. This enables LayerAnimator to animate property changes. | 36 // LayerAnimator. This enables LayerAnimator to animate property changes. |
36 // NB: during many tests, set_disable_animations_for_test is used and causes | 37 // NB: during many tests, set_disable_animations_for_test is used and causes |
37 // all animations to complete immediately. The layer animation is ref counted | 38 // all animations to complete immediately. The layer animation is ref counted |
38 // so that if its owning layer is deleted (and the owning layer is only other | 39 // so that if its owning layer is deleted (and the owning layer is only other |
39 // class that should ever hold a ref ptr to a LayerAnimator), the animator can | 40 // class that should ever hold a ref ptr to a LayerAnimator), the animator can |
40 // ensure that it is not disposed of until it finishes executing. It does this | 41 // ensure that it is not disposed of until it finishes executing. It does this |
41 // by holding a reference to itself for the duration of methods for which it | 42 // by holding a reference to itself for the duration of methods for which it |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 187 |
187 // When set to true, all animations complete immediately. | 188 // When set to true, all animations complete immediately. |
188 static void set_disable_animations_for_test(bool disable_animations) { | 189 static void set_disable_animations_for_test(bool disable_animations) { |
189 disable_animations_for_test_ = disable_animations; | 190 disable_animations_for_test_ = disable_animations; |
190 } | 191 } |
191 | 192 |
192 static bool disable_animations_for_test() { | 193 static bool disable_animations_for_test() { |
193 return disable_animations_for_test_; | 194 return disable_animations_for_test_; |
194 } | 195 } |
195 | 196 |
| 197 // Takes ownership of the given timer. |
| 198 // FIXME(vollick): Once we've written a TestLayerAnimationTimer than can be |
| 199 // used to advance animations, we can probably get rid of last_tick_time() and |
| 200 // all the code in the layer animation tests that advances animations using |
| 201 // AnimationContainerElement::Step. |
| 202 static void SetAnimationTimer(LayerAnimationTimer* timer); |
| 203 |
196 protected: | 204 protected: |
197 virtual ~LayerAnimator(); | 205 virtual ~LayerAnimator(); |
198 | 206 |
199 LayerAnimationDelegate* delegate() { return delegate_; } | 207 LayerAnimationDelegate* delegate() { return delegate_; } |
200 const LayerAnimationDelegate* delegate() const { return delegate_; } | 208 const LayerAnimationDelegate* delegate() const { return delegate_; } |
201 | 209 |
202 // Virtual for testing. | 210 // Virtual for testing. |
203 virtual void ProgressAnimation(LayerAnimationSequence* sequence, | 211 virtual void ProgressAnimation(LayerAnimationSequence* sequence, |
204 base::TimeDelta delta); | 212 base::TimeDelta delta); |
205 | 213 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 // Observers are notified when layer animations end, are scheduled or are | 364 // Observers are notified when layer animations end, are scheduled or are |
357 // aborted. | 365 // aborted. |
358 ObserverList<LayerAnimationObserver> observers_; | 366 ObserverList<LayerAnimationObserver> observers_; |
359 | 367 |
360 DISALLOW_COPY_AND_ASSIGN(LayerAnimator); | 368 DISALLOW_COPY_AND_ASSIGN(LayerAnimator); |
361 }; | 369 }; |
362 | 370 |
363 } // namespace ui | 371 } // namespace ui |
364 | 372 |
365 #endif // UI_COMPOSITOR_LAYER_ANIMATOR_H_ | 373 #endif // UI_COMPOSITOR_LAYER_ANIMATOR_H_ |
OLD | NEW |