OLD | NEW |
1 // Copyright (c) 2011 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 #include "ui/base/animation/throb_animation.h" | 5 #include "ui/base/animation/throb_animation.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 namespace ui { | 9 namespace ui { |
10 | 10 |
11 static const int kDefaultThrobDurationMS = 400; | 11 static const int kDefaultThrobDurationMS = 400; |
(...skipping 16 matching lines...) Expand all Loading... |
28 return; // We're already running, we'll cycle when current loop finishes. | 28 return; // We're already running, we'll cycle when current loop finishes. |
29 | 29 |
30 if (IsShowing()) | 30 if (IsShowing()) |
31 SlideAnimation::Hide(); | 31 SlideAnimation::Hide(); |
32 else | 32 else |
33 SlideAnimation::Show(); | 33 SlideAnimation::Show(); |
34 cycles_remaining_ = cycles_til_stop; | 34 cycles_remaining_ = cycles_til_stop; |
35 } | 35 } |
36 | 36 |
37 void ThrobAnimation::Reset() { | 37 void ThrobAnimation::Reset() { |
| 38 Reset(0); |
| 39 } |
| 40 |
| 41 void ThrobAnimation::Reset(double value) { |
38 ResetForSlide(); | 42 ResetForSlide(); |
39 SlideAnimation::Reset(); | 43 SlideAnimation::Reset(value); |
40 } | 44 } |
41 | 45 |
42 void ThrobAnimation::Show() { | 46 void ThrobAnimation::Show() { |
43 ResetForSlide(); | 47 ResetForSlide(); |
44 SlideAnimation::Show(); | 48 SlideAnimation::Show(); |
45 } | 49 } |
46 | 50 |
47 void ThrobAnimation::Hide() { | 51 void ThrobAnimation::Hide() { |
48 ResetForSlide(); | 52 ResetForSlide(); |
49 SlideAnimation::Hide(); | 53 SlideAnimation::Hide(); |
(...skipping 22 matching lines...) Expand all Loading... |
72 } | 76 } |
73 } | 77 } |
74 | 78 |
75 void ThrobAnimation::ResetForSlide() { | 79 void ThrobAnimation::ResetForSlide() { |
76 SlideAnimation::SetSlideDuration(slide_duration_); | 80 SlideAnimation::SetSlideDuration(slide_duration_); |
77 cycles_remaining_ = 0; | 81 cycles_remaining_ = 0; |
78 throbbing_ = false; | 82 throbbing_ = false; |
79 } | 83 } |
80 | 84 |
81 } // namespace ui | 85 } // namespace ui |
OLD | NEW |