summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/common/animation.cc6
-rw-r--r--chrome/common/animation.h8
-rw-r--r--chrome/common/throb_animation.cc4
-rw-r--r--chrome/common/throb_animation.h2
4 files changed, 14 insertions, 6 deletions
diff --git a/chrome/common/animation.cc b/chrome/common/animation.cc
index bf69812..315f9f5 100644
--- a/chrome/common/animation.cc
+++ b/chrome/common/animation.cc
@@ -97,7 +97,7 @@ void Animation::SetDuration(int duration) {
current_iteration_ = 0;
}
-void Animation::Run() {
+void Animation::Step() {
state_ = static_cast<double>(++current_iteration_) / iteration_count_;
if (state_ >= 1.0)
@@ -111,6 +111,10 @@ void Animation::Run() {
Stop();
}
+void Animation::Run() {
+ Step();
+}
+
int Animation::CalculateInterval(int frame_rate) {
int timer_interval = 1000 / frame_rate;
if (timer_interval < 10)
diff --git a/chrome/common/animation.h b/chrome/common/animation.h
index 657512a..0b4dc6a 100644
--- a/chrome/common/animation.h
+++ b/chrome/common/animation.h
@@ -90,8 +90,8 @@ class Animation {
void SetDuration(int duration);
protected:
- // Called when the animation's timer expires.
- void Run();
+ // Overriddable, called by Run.
+ virtual void Step();
// Calculates the timer interval from the constructor list.
int CalculateInterval(int frame_rate);
@@ -112,6 +112,10 @@ class Animation {
base::RepeatingTimer<Animation> timer_;
+ private:
+ // Called when the animation's timer expires, calls Step.
+ void Run();
+
DISALLOW_EVIL_CONSTRUCTORS(Animation);
};
diff --git a/chrome/common/throb_animation.cc b/chrome/common/throb_animation.cc
index 80ea10e..be7a852 100644
--- a/chrome/common/throb_animation.cc
+++ b/chrome/common/throb_animation.cc
@@ -43,8 +43,8 @@ void ThrobAnimation::Hide() {
SlideAnimation::Hide();
}
-void ThrobAnimation::Run() {
- SlideAnimation::Run();
+void ThrobAnimation::Step() {
+ Animation::Step();
if (!IsAnimating() && throbbing_) {
// Were throbbing a finished a cycle. Start the next cycle unless we're at
// the end of the cycles, in which case we stop.
diff --git a/chrome/common/throb_animation.h b/chrome/common/throb_animation.h
index e5d5ed88..66bb5ad 100644
--- a/chrome/common/throb_animation.h
+++ b/chrome/common/throb_animation.h
@@ -32,7 +32,7 @@ class ThrobAnimation : public SlideAnimation {
virtual void Hide();
// Overriden to continually throb (assuming we're throbbing).
- virtual void Run();
+ virtual void Step();
// Overridden to maintain the slide duration.
virtual void SetSlideDuration(int duration) { slide_duration_ = duration; }