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