OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_GFX_ANIMATION_ANIMATION_CONTAINER_H_ | 5 #ifndef UI_GFX_ANIMATION_ANIMATION_CONTAINER_H_ |
6 #define UI_GFX_ANIMATION_ANIMATION_CONTAINER_H_ | 6 #define UI_GFX_ANIMATION_ANIMATION_CONTAINER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "base/timer/timer.h" | 13 #include "base/timer/timer.h" |
14 #include "ui/gfx/gfx_export.h" | 14 #include "ui/gfx/gfx_export.h" |
15 | 15 |
16 namespace gfx { | 16 namespace gfx { |
17 | 17 |
18 class AnimationContainerElement; | 18 class AnimationContainerElement; |
19 class AnimationContainerObserver; | 19 class AnimationContainerObserver; |
20 | 20 |
21 // AnimationContainer is used by Animation to manage the underlying timer. | 21 // AnimationContainer is used by Animation to manage the underlying timer. |
22 // Internally each Animation creates a single AnimationContainer. You can | 22 // Internally each Animation creates a single AnimationContainer. You can |
23 // group a set of Animations into the same AnimationContainer by way of | 23 // group a set of Animations into the same AnimationContainer by way of |
24 // Animation::SetContainer. Grouping a set of Animations into the same | 24 // Animation::SetContainer. Grouping a set of Animations into the same |
25 // AnimationContainer ensures they all update and start at the same time. | 25 // AnimationContainer ensures they all update and start at the same time. |
26 // | 26 // |
27 // AnimationContainer is ref counted. Each Animation contained within the | 27 // AnimationContainer is ref counted. Each Animation contained within the |
28 // AnimationContainer own it. | 28 // AnimationContainer own it. |
| 29 // |
| 30 // TODO(bruthig): Enhance to use the same clock source as |timer_| so that tests |
| 31 // can control animations using a SingleThreadTaskRunner test double. |
| 32 // (See https://crbug.com/630684) |
29 class GFX_EXPORT AnimationContainer | 33 class GFX_EXPORT AnimationContainer |
30 : public base::RefCounted<AnimationContainer> { | 34 : public base::RefCounted<AnimationContainer> { |
31 public: | 35 public: |
32 AnimationContainer(); | 36 AnimationContainer(); |
33 | 37 |
34 // Invoked by Animation when it needs to start. Starts the timer if necessary. | 38 // Invoked by Animation when it needs to start. Starts the timer if necessary. |
35 // NOTE: This is invoked by Animation for you, you shouldn't invoke this | 39 // NOTE: This is invoked by Animation for you, you shouldn't invoke this |
36 // directly. | 40 // directly. |
37 void Start(AnimationContainerElement* animation); | 41 void Start(AnimationContainerElement* animation); |
38 | 42 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 base::RepeatingTimer timer_; | 87 base::RepeatingTimer timer_; |
84 | 88 |
85 AnimationContainerObserver* observer_; | 89 AnimationContainerObserver* observer_; |
86 | 90 |
87 DISALLOW_COPY_AND_ASSIGN(AnimationContainer); | 91 DISALLOW_COPY_AND_ASSIGN(AnimationContainer); |
88 }; | 92 }; |
89 | 93 |
90 } // namespace gfx | 94 } // namespace gfx |
91 | 95 |
92 #endif // UI_GFX_ANIMATION_ANIMATION_CONTAINER_H_ | 96 #endif // UI_GFX_ANIMATION_ANIMATION_CONTAINER_H_ |
OLD | NEW |