OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 APP_THROB_ANIMATION_H_ | 5 #ifndef APP_THROB_ANIMATION_H_ |
6 #define APP_THROB_ANIMATION_H_ | 6 #define APP_THROB_ANIMATION_H_ |
7 | 7 |
8 #include "app/slide_animation.h" | 8 #include "app/slide_animation.h" |
9 | 9 |
10 // A subclass of SlideAnimation that can continually slide. All of the Animation | 10 // A subclass of SlideAnimation that can continually slide. All of the Animation |
(...skipping 13 matching lines...) Expand all Loading... |
24 void StartThrobbing(int cycles_til_stop); | 24 void StartThrobbing(int cycles_til_stop); |
25 | 25 |
26 // Sets the duration of the slide animation when throbbing. | 26 // Sets the duration of the slide animation when throbbing. |
27 void SetThrobDuration(int duration) { throb_duration_ = duration; } | 27 void SetThrobDuration(int duration) { throb_duration_ = duration; } |
28 | 28 |
29 // Overridden to reset to the slide duration. | 29 // Overridden to reset to the slide duration. |
30 virtual void Reset(); | 30 virtual void Reset(); |
31 virtual void Show(); | 31 virtual void Show(); |
32 virtual void Hide(); | 32 virtual void Hide(); |
33 | 33 |
34 // Overriden to continually throb (assuming we're throbbing). | |
35 virtual void Step(); | |
36 | |
37 // Overridden to maintain the slide duration. | 34 // Overridden to maintain the slide duration. |
38 virtual void SetSlideDuration(int duration) { slide_duration_ = duration; } | 35 virtual void SetSlideDuration(int duration) { slide_duration_ = duration; } |
39 | 36 |
40 // The number of cycles remaining until the animation stops. | 37 // The number of cycles remaining until the animation stops. |
41 void set_cycles_remaining(int value) { cycles_remaining_ = value; } | 38 void set_cycles_remaining(int value) { cycles_remaining_ = value; } |
42 int cycles_remaining() const { return cycles_remaining_; } | 39 int cycles_remaining() const { return cycles_remaining_; } |
43 | 40 |
| 41 protected: |
| 42 // Overriden to continually throb (assuming we're throbbing). |
| 43 virtual void Step(base::TimeTicks time_now); |
| 44 |
44 private: | 45 private: |
45 // Resets state such that we behave like SlideAnimation. | 46 // Resets state such that we behave like SlideAnimation. |
46 void ResetForSlide(); | 47 void ResetForSlide(); |
47 | 48 |
48 // Duration of the slide animation. | 49 // Duration of the slide animation. |
49 int slide_duration_; | 50 int slide_duration_; |
50 | 51 |
51 // Duration of the slide animation when throbbing. | 52 // Duration of the slide animation when throbbing. |
52 int throb_duration_; | 53 int throb_duration_; |
53 | 54 |
54 // If throbbing, this is the number of cycles left. | 55 // If throbbing, this is the number of cycles left. |
55 int cycles_remaining_; | 56 int cycles_remaining_; |
56 | 57 |
57 // Are we throbbing? | 58 // Are we throbbing? |
58 bool throbbing_; | 59 bool throbbing_; |
59 | 60 |
60 DISALLOW_COPY_AND_ASSIGN(ThrobAnimation); | 61 DISALLOW_COPY_AND_ASSIGN(ThrobAnimation); |
61 }; | 62 }; |
62 | 63 |
63 #endif // APP_THROB_ANIMATION_H_ | 64 #endif // APP_THROB_ANIMATION_H_ |
OLD | NEW |