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_ANIMATION_ELEMENT_H_ | 5 #ifndef UI_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_ |
6 #define UI_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_ | 6 #define UI_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/time.h" | 10 #include "base/time.h" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 protected: | 185 protected: |
186 // Called once each time the animation element is run before any call to | 186 // Called once each time the animation element is run before any call to |
187 // OnProgress. | 187 // OnProgress. |
188 virtual void OnStart(LayerAnimationDelegate* delegate) = 0; | 188 virtual void OnStart(LayerAnimationDelegate* delegate) = 0; |
189 virtual bool OnProgress(double t, LayerAnimationDelegate* delegate) = 0; | 189 virtual bool OnProgress(double t, LayerAnimationDelegate* delegate) = 0; |
190 virtual void OnGetTarget(TargetValue* target) const = 0; | 190 virtual void OnGetTarget(TargetValue* target) const = 0; |
191 virtual void OnAbort(LayerAnimationDelegate* delegate) = 0; | 191 virtual void OnAbort(LayerAnimationDelegate* delegate) = 0; |
192 | 192 |
193 base::TimeDelta duration() const { return duration_; } | 193 base::TimeDelta duration() const { return duration_; } |
194 | 194 |
| 195 base::TimeDelta duration() { return duration_; } |
| 196 |
195 // Actually start the animation, dispatching to another thread if needed. | 197 // Actually start the animation, dispatching to another thread if needed. |
196 virtual void RequestEffectiveStart(LayerAnimationDelegate* delegate); | 198 virtual void RequestEffectiveStart(LayerAnimationDelegate* delegate); |
197 | 199 |
198 private: | 200 private: |
199 // For debugging purposes, we sometimes alter the duration we actually use. | 201 // For debugging purposes, we sometimes alter the duration we actually use. |
200 // For example, during tests we often set duration = 0, and it is sometimes | 202 // For example, during tests we often set duration = 0, and it is sometimes |
201 // useful to slow animations down to see them more clearly. | 203 // useful to slow animations down to see them more clearly. |
202 base::TimeDelta GetEffectiveDuration(const base::TimeDelta& delta); | 204 base::TimeDelta GetEffectiveDuration(const base::TimeDelta& delta); |
203 | 205 |
204 bool first_frame_; | 206 bool first_frame_; |
205 const AnimatableProperties properties_; | 207 const AnimatableProperties properties_; |
206 base::TimeTicks requested_start_time_; | 208 base::TimeTicks requested_start_time_; |
207 | 209 |
208 // When the animation actually started, taking into account queueing delays. | 210 // When the animation actually started, taking into account queueing delays. |
209 base::TimeTicks effective_start_time_; | 211 base::TimeTicks effective_start_time_; |
210 const base::TimeDelta duration_; | 212 const base::TimeDelta duration_; |
211 Tween::Type tween_type_; | 213 Tween::Type tween_type_; |
212 | 214 |
213 const int animation_id_; | 215 const int animation_id_; |
214 int animation_group_id_; | 216 int animation_group_id_; |
215 | 217 |
216 double last_progressed_fraction_; | 218 double last_progressed_fraction_; |
217 | 219 |
218 DISALLOW_COPY_AND_ASSIGN(LayerAnimationElement); | 220 DISALLOW_COPY_AND_ASSIGN(LayerAnimationElement); |
219 }; | 221 }; |
220 | 222 |
221 } // namespace ui | 223 } // namespace ui |
222 | 224 |
223 #endif // UI_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_ | 225 #endif // UI_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_ |
OLD | NEW |