| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "chrome/browser/ui/autofill/loading_animation.h" | 5 #include "chrome/browser/ui/autofill/loading_animation.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ui/gfx/animation/tween.h" | 8 #include "ui/gfx/animation/tween.h" |
| 9 #include "ui/gfx/frame_time.h" |
| 9 | 10 |
| 10 namespace autofill { | 11 namespace autofill { |
| 11 | 12 |
| 12 // Duration of one cycle of the animation. | 13 // Duration of one cycle of the animation. |
| 13 static const int kDurationMs = 1800; | 14 static const int kDurationMs = 1800; |
| 14 | 15 |
| 15 // The frame rate of the animation. | 16 // The frame rate of the animation. |
| 16 static const int kHertz = 60; | 17 static const int kHertz = 60; |
| 17 | 18 |
| 18 LoadingAnimation::LoadingAnimation(gfx::AnimationDelegate* delegate) | 19 LoadingAnimation::LoadingAnimation(gfx::AnimationDelegate* delegate) |
| 19 : LinearAnimation(kDurationMs, kHertz, delegate), | 20 : LinearAnimation(kDurationMs, kHertz, delegate), |
| 20 first_cycle_(true) {} | 21 first_cycle_(true) {} |
| 21 | 22 |
| 22 LoadingAnimation::~LoadingAnimation() {} | 23 LoadingAnimation::~LoadingAnimation() {} |
| 23 | 24 |
| 24 void LoadingAnimation::Step(base::TimeTicks time_now) { | 25 void LoadingAnimation::Step(gfx::FrameTime time_now) { |
| 25 LinearAnimation::Step(time_now); | 26 LinearAnimation::Step(time_now); |
| 26 | 27 |
| 27 if (!is_animating()) { | 28 if (!is_animating()) { |
| 28 first_cycle_ = false; | 29 first_cycle_ = false; |
| 29 Start(); | 30 Start(); |
| 30 } | 31 } |
| 31 } | 32 } |
| 32 | 33 |
| 33 double LoadingAnimation::GetCurrentValueForDot(size_t dot_i) { | 34 double LoadingAnimation::GetCurrentValueForDot(size_t dot_i) { |
| 34 double base_value = gfx::LinearAnimation::GetCurrentValue(); | 35 double base_value = gfx::LinearAnimation::GetCurrentValue(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 NOTREACHED(); | 71 NOTREACHED(); |
| 71 return 0.0; | 72 return 0.0; |
| 72 } | 73 } |
| 73 | 74 |
| 74 void LoadingAnimation::Reset() { | 75 void LoadingAnimation::Reset() { |
| 75 Stop(); | 76 Stop(); |
| 76 first_cycle_ = true; | 77 first_cycle_ = true; |
| 77 } | 78 } |
| 78 | 79 |
| 79 } // namespace autofill | 80 } // namespace autofill |
| OLD | NEW |