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_H_ | 5 #ifndef UI_BASE_ANIMATION_ANIMATION_H_ |
6 #define UI_BASE_ANIMATION_ANIMATION_H_ | 6 #define UI_BASE_ANIMATION_ANIMATION_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 // Sets the delegate. | 51 // Sets the delegate. |
52 void set_delegate(AnimationDelegate* delegate) { delegate_ = delegate; } | 52 void set_delegate(AnimationDelegate* delegate) { delegate_ = delegate; } |
53 | 53 |
54 // Sets the container used to manage the timer. A value of NULL results in | 54 // Sets the container used to manage the timer. A value of NULL results in |
55 // creating a new AnimationContainer. | 55 // creating a new AnimationContainer. |
56 void SetContainer(AnimationContainer* container); | 56 void SetContainer(AnimationContainer* container); |
57 | 57 |
58 bool is_animating() const { return is_animating_; } | 58 bool is_animating() const { return is_animating_; } |
59 | 59 |
60 base::TimeDelta timer_interval() const { return timer_interval_; } | 60 base::TimeDelta timer_interval() const { return timer_interval_; } |
| 61 void set_timer_interval(base::TimeDelta time) { timer_interval_ = time; } |
61 | 62 |
62 // Returns true if rich animations should be rendered. | 63 // Returns true if rich animations should be rendered. |
63 // Looks at session type (e.g. remote desktop) and accessibility settings | 64 // Looks at session type (e.g. remote desktop) and accessibility settings |
64 // to give guidance for heavy animations such as "start download" arrow. | 65 // to give guidance for heavy animations such as "start download" arrow. |
65 static bool ShouldRenderRichAnimation(); | 66 static bool ShouldRenderRichAnimation(); |
66 | 67 |
67 protected: | 68 protected: |
68 // Invoked from Start to allow subclasses to prepare for the animation. | 69 // Invoked from Start to allow subclasses to prepare for the animation. |
69 virtual void AnimationStarted() {} | 70 virtual void AnimationStarted() {} |
70 | 71 |
(...skipping 10 matching lines...) Expand all Loading... |
81 base::TimeTicks start_time() const { return start_time_; } | 82 base::TimeTicks start_time() const { return start_time_; } |
82 AnimationDelegate* delegate() { return delegate_; } | 83 AnimationDelegate* delegate() { return delegate_; } |
83 | 84 |
84 // AnimationContainer::Element overrides | 85 // AnimationContainer::Element overrides |
85 virtual void SetStartTime(base::TimeTicks start_time) OVERRIDE; | 86 virtual void SetStartTime(base::TimeTicks start_time) OVERRIDE; |
86 virtual void Step(base::TimeTicks time_now) = 0; | 87 virtual void Step(base::TimeTicks time_now) = 0; |
87 virtual base::TimeDelta GetTimerInterval() const OVERRIDE; | 88 virtual base::TimeDelta GetTimerInterval() const OVERRIDE; |
88 | 89 |
89 private: | 90 private: |
90 // Interval for the animation. | 91 // Interval for the animation. |
91 const base::TimeDelta timer_interval_; | 92 base::TimeDelta timer_interval_; |
92 | 93 |
93 // If true we're running. | 94 // If true we're running. |
94 bool is_animating_; | 95 bool is_animating_; |
95 | 96 |
96 // Our delegate; may be null. | 97 // Our delegate; may be null. |
97 AnimationDelegate* delegate_; | 98 AnimationDelegate* delegate_; |
98 | 99 |
99 // Container we're in. If non-null we're animating. | 100 // Container we're in. If non-null we're animating. |
100 scoped_refptr<AnimationContainer> container_; | 101 scoped_refptr<AnimationContainer> container_; |
101 | 102 |
102 // Time we started at. | 103 // Time we started at. |
103 base::TimeTicks start_time_; | 104 base::TimeTicks start_time_; |
104 | 105 |
105 DISALLOW_COPY_AND_ASSIGN(Animation); | 106 DISALLOW_COPY_AND_ASSIGN(Animation); |
106 }; | 107 }; |
107 | 108 |
108 } // namespace ui | 109 } // namespace ui |
109 | 110 |
110 #endif // UI_BASE_ANIMATION_ANIMATION_H_ | 111 #endif // UI_BASE_ANIMATION_ANIMATION_H_ |
OLD | NEW |