Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(684)

Unified Diff: chrome/browser/ui/autofill/loading_animation.cc

Issue 73723002: [rAc OSX] Animate the dots in the "Loading ..." message. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clean up new files Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/autofill/loading_animation.cc
diff --git a/chrome/browser/ui/autofill/loading_animation.cc b/chrome/browser/ui/autofill/loading_animation.cc
index 800ff3de8240b80c74c0aa492435724ead5a5c78..f11109adb58d75797169ff52101e8d668333c7a2 100644
--- a/chrome/browser/ui/autofill/loading_animation.cc
+++ b/chrome/browser/ui/autofill/loading_animation.cc
@@ -30,7 +30,7 @@ void LoadingAnimation::Step(base::TimeTicks time_now) {
}
}
-double LoadingAnimation::GetCurrentValueForDot(size_t dot_i) {
+double LoadingAnimation::GetCurrentValueForDot(size_t dot_i) const {
double base_value = gfx::LinearAnimation::GetCurrentValue();
const double kSecondDotDelayMs = 100.0;
@@ -45,7 +45,7 @@ double LoadingAnimation::GetCurrentValueForDot(size_t dot_i) {
double value = gfx::Tween::CalculateValue(gfx::Tween::EASE_OUT, base_value);
- static AnimationFrame animation_frames[] = {
+ static AnimationFrame kAnimationFrames[] = {
{ 0.0, 0.0 },
{ 0.55, 0.0 },
{ 0.6, -1.0 },
@@ -54,17 +54,24 @@ double LoadingAnimation::GetCurrentValueForDot(size_t dot_i) {
{ 0.95, 0.1 },
{ 1.0, 0.0 },
};
+ static double kScale = 10.0;
Evan Stade 2013/11/15 21:58:46 nit: I don't really see the benefit in doing this
groby-ooo-7-16 2013/11/15 23:03:38 +1 on the ctor doing htis.
Ilya Sherman 2013/11/16 00:31:13 Done.
- for (size_t i = 0; i < arraysize(animation_frames); ++i) {
- if (value > animation_frames[i].value)
+ for (size_t i = 0; i < arraysize(kAnimationFrames); ++i) {
+ if (value > kAnimationFrames[i].value)
continue;
- else if (i == 0)
- return animation_frames[i].position;
- return animation_frames[i - 1].position +
- (animation_frames[i].position - animation_frames[i - 1].position) *
- (value - animation_frames[i - 1].value) /
- (animation_frames[i].value - animation_frames[i - 1].value);
+ double position;
+ if (i == 0) {
+ position = kAnimationFrames[i].position;
+ } else {
+ double distance =
Evan Stade 2013/11/15 21:58:46 nit: IMO, the distance and progress variable names
Ilya Sherman 2013/11/16 00:31:13 Done.
+ kAnimationFrames[i].position - kAnimationFrames[i - 1].position;
+ double progress =
+ (value - kAnimationFrames[i - 1].value) /
+ (kAnimationFrames[i].value - kAnimationFrames[i - 1].value);
+ position = kAnimationFrames[i - 1].position + distance * progress;
groby-ooo-7-16 2013/11/15 23:03:38 I kind of like clearing up the computation, becaus
Ilya Sherman 2013/11/16 00:31:13 Done. Good call on using Tween::FloatValueBetween
+ }
+ return position * kScale;
}
NOTREACHED();

Powered by Google App Engine
This is Rietveld 408576698