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

Unified Diff: ui/views/animation/bounds_animator.cc

Issue 10068027: ash: Fix launcher icon overlaps with status. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 8 months 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
« no previous file with comments | « ui/views/animation/bounds_animator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/animation/bounds_animator.cc
diff --git a/ui/views/animation/bounds_animator.cc b/ui/views/animation/bounds_animator.cc
index 2e4b0c1e48520b8796fd74cc8c50941dcd36a619..3e7c93e590f1c5d4fe1e33aaf2a98fe5e96e3adc 100644
--- a/ui/views/animation/bounds_animator.cc
+++ b/ui/views/animation/bounds_animator.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,7 +10,7 @@
#include "ui/views/view.h"
// Duration in milliseconds for animations.
-static const int kAnimationDuration = 200;
+static const int kDefaultAnimationDuration = 200;
using ui::Animation;
using ui::AnimationContainer;
@@ -21,8 +21,8 @@ namespace views {
BoundsAnimator::BoundsAnimator(View* parent)
: parent_(parent),
- observer_(NULL),
- container_(new AnimationContainer()) {
+ container_(new AnimationContainer()),
+ animation_duration_ms_(kDefaultAnimationDuration) {
container_->set_observer(this);
}
@@ -137,10 +137,22 @@ void BoundsAnimator::Cancel() {
AnimationContainerProgressed(container_.get());
}
+void BoundsAnimator::SetAnimationDuration(int duration_ms) {
+ animation_duration_ms_ = duration_ms;
+}
+
+void BoundsAnimator::AddObserver(BoundsAnimatorObserver* observer) {
+ observers_.AddObserver(observer);
+}
+
+void BoundsAnimator::RemoveObserver(BoundsAnimatorObserver* observer) {
+ observers_.RemoveObserver(observer);
+}
+
SlideAnimation* BoundsAnimator::CreateAnimation() {
SlideAnimation* animation = new SlideAnimation(this);
animation->SetContainer(container_.get());
- animation->SetSlideDuration(kAnimationDuration);
+ animation->SetSlideDuration(animation_duration_ms_);
animation->SetTweenType(Tween::EASE_OUT);
return animation;
}
@@ -249,10 +261,12 @@ void BoundsAnimator::AnimationContainerProgressed(
repaint_bounds_.SetRect(0, 0, 0, 0);
}
- if (observer_ && !IsAnimating()) {
+ if (!IsAnimating()) {
// Notify here rather than from AnimationXXX to avoid deleting the animation
// while the animation is calling us.
- observer_->OnBoundsAnimatorDone(this);
+ FOR_EACH_OBSERVER(BoundsAnimatorObserver,
+ observers_,
+ OnBoundsAnimatorDone(this));
}
}
« no previous file with comments | « ui/views/animation/bounds_animator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698