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_BASE_ANIMATION_ANIMATION_CONTAINER_H_ | 5 #ifndef UI_BASE_ANIMATION_ANIMATION_CONTAINER_H_ |
6 #define UI_BASE_ANIMATION_ANIMATION_CONTAINER_H_ | 6 #define UI_BASE_ANIMATION_ANIMATION_CONTAINER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/time.h" | 11 #include "base/time.h" |
12 #include "base/timer.h" | 12 #include "base/timer.h" |
13 #include "ui/base/ui_export.h" | 13 #include "ui/base/ui_export.h" |
14 | 14 |
15 namespace ui { | 15 namespace ui { |
16 | 16 |
17 class AnimationContainerElement; | 17 class AnimationContainerElement; |
18 class AnimationContainerObserver; | 18 class AnimationContainerObserver; |
19 | 19 |
| 20 namespace test { |
| 21 class AnimationContainerTestHelper; |
| 22 } |
| 23 |
20 // AnimationContainer is used by Animation to manage the underlying timer. | 24 // AnimationContainer is used by Animation to manage the underlying timer. |
21 // Internally each Animation creates a single AnimationContainer. You can | 25 // Internally each Animation creates a single AnimationContainer. You can |
22 // group a set of Animations into the same AnimationContainer by way of | 26 // group a set of Animations into the same AnimationContainer by way of |
23 // Animation::SetContainer. Grouping a set of Animations into the same | 27 // Animation::SetContainer. Grouping a set of Animations into the same |
24 // AnimationContainer ensures they all update and start at the same time. | 28 // AnimationContainer ensures they all update and start at the same time. |
25 // | 29 // |
26 // AnimationContainer is ref counted. Each Animation contained within the | 30 // AnimationContainer is ref counted. Each Animation contained within the |
27 // AnimationContainer own it. | 31 // AnimationContainer own it. |
28 class UI_EXPORT AnimationContainer | 32 class UI_EXPORT AnimationContainer |
29 : public base::RefCounted<AnimationContainer> { | 33 : public base::RefCounted<AnimationContainer> { |
(...skipping 16 matching lines...) Expand all Loading... |
46 } | 50 } |
47 | 51 |
48 // The time the last animation ran at. | 52 // The time the last animation ran at. |
49 base::TimeTicks last_tick_time() const { return last_tick_time_; } | 53 base::TimeTicks last_tick_time() const { return last_tick_time_; } |
50 | 54 |
51 // Are there any timers running? | 55 // Are there any timers running? |
52 bool is_running() const { return !elements_.empty(); } | 56 bool is_running() const { return !elements_.empty(); } |
53 | 57 |
54 private: | 58 private: |
55 friend class base::RefCounted<AnimationContainer>; | 59 friend class base::RefCounted<AnimationContainer>; |
| 60 friend class test::AnimationContainerTestHelper; |
56 | 61 |
57 typedef std::set<AnimationContainerElement*> Elements; | 62 typedef std::set<AnimationContainerElement*> Elements; |
58 | 63 |
59 ~AnimationContainer(); | 64 ~AnimationContainer(); |
60 | 65 |
61 // Timer callback method. | 66 // Timer callback method. |
62 void Run(); | 67 void Run(); |
63 | 68 |
64 // Sets min_timer_interval_ and restarts the timer. | 69 // Sets min_timer_interval_ and restarts the timer. |
65 void SetMinTimerInterval(base::TimeDelta delta); | 70 void SetMinTimerInterval(base::TimeDelta delta); |
(...skipping 16 matching lines...) Expand all Loading... |
82 base::RepeatingTimer<AnimationContainer> timer_; | 87 base::RepeatingTimer<AnimationContainer> timer_; |
83 | 88 |
84 AnimationContainerObserver* observer_; | 89 AnimationContainerObserver* observer_; |
85 | 90 |
86 DISALLOW_COPY_AND_ASSIGN(AnimationContainer); | 91 DISALLOW_COPY_AND_ASSIGN(AnimationContainer); |
87 }; | 92 }; |
88 | 93 |
89 } // namespace ui | 94 } // namespace ui |
90 | 95 |
91 #endif // UI_BASE_ANIMATION_ANIMATION_CONTAINER_H_ | 96 #endif // UI_BASE_ANIMATION_ANIMATION_CONTAINER_H_ |
OLD | NEW |