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