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 #ifndef CHROME_BROWSER_UI_AUTOFILL_LOADING_ANIMATION_H_ | 5 #ifndef CHROME_BROWSER_UI_AUTOFILL_LOADING_ANIMATION_H_ |
6 #define CHROME_BROWSER_UI_AUTOFILL_LOADING_ANIMATION_H_ | 6 #define CHROME_BROWSER_UI_AUTOFILL_LOADING_ANIMATION_H_ |
7 | 7 |
8 #include "ui/gfx/animation/linear_animation.h" | 8 #include "ui/gfx/animation/linear_animation.h" |
9 | 9 |
10 namespace autofill { | 10 namespace autofill { |
11 | 11 |
12 // An animation for a dancing ellipsis. | 12 // An animation for a dancing ellipsis. |
13 class LoadingAnimation : public gfx::LinearAnimation { | 13 class LoadingAnimation : public gfx::LinearAnimation { |
14 public: | 14 public: |
15 explicit LoadingAnimation(gfx::AnimationDelegate* delegate, | 15 explicit LoadingAnimation(gfx::AnimationDelegate* delegate, |
16 int font_height); | 16 int font_height); |
17 virtual ~LoadingAnimation(); | 17 virtual ~LoadingAnimation(); |
18 | 18 |
19 // gfx::Animation implementation. | 19 // gfx::Animation implementation. |
20 virtual void Step(base::TimeTicks time_now) OVERRIDE; | 20 virtual void Step(base::TimeTicks time_now) override; |
21 | 21 |
22 // Returns the vertical pixel offset for the nth dot. | 22 // Returns the vertical pixel offset for the nth dot. |
23 double GetCurrentValueForDot(size_t dot_i) const; | 23 double GetCurrentValueForDot(size_t dot_i) const; |
24 | 24 |
25 // Stops this animation. Use this instead of Stop() to make sure future | 25 // Stops this animation. Use this instead of Stop() to make sure future |
26 // runs don't mess up on the first cycle. | 26 // runs don't mess up on the first cycle. |
27 void Reset(); | 27 void Reset(); |
28 | 28 |
29 private: | 29 private: |
30 // Describes a frame of the animation, a la -webkit-keyframes. | 30 // Describes a frame of the animation, a la -webkit-keyframes. |
31 struct AnimationFrame { | 31 struct AnimationFrame { |
32 double value; | 32 double value; |
33 double position; | 33 double position; |
34 }; | 34 }; |
35 | 35 |
36 // True if the current cycle is the first one since Reset() was last called. | 36 // True if the current cycle is the first one since Reset() was last called. |
37 bool first_cycle_; | 37 bool first_cycle_; |
38 | 38 |
39 // The font height of the loading text, which gives the factor by which to | 39 // The font height of the loading text, which gives the factor by which to |
40 // scale the animation. | 40 // scale the animation. |
41 const int font_height_; | 41 const int font_height_; |
42 }; | 42 }; |
43 | 43 |
44 } // namespace autofill | 44 } // namespace autofill |
45 | 45 |
46 #endif // CHROME_BROWSER_UI_AUTOFILL_LOADING_ANIMATION_H_ | 46 #endif // CHROME_BROWSER_UI_AUTOFILL_LOADING_ANIMATION_H_ |
OLD | NEW |