summaryrefslogtreecommitdiffstats
path: root/views/animation/bounds_animator.h
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-07 19:27:24 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-07 19:27:24 +0000
commit8bd8aa1f07df8752a74e79bbcfb6d49e8a49d517 (patch)
tree0e1be35cc0e0caea9d20d064f95a7a426fc8fa04 /views/animation/bounds_animator.h
parent4f9cd41c22af611e92609757fdcb3a5de01c3752 (diff)
downloadchromium_src-8bd8aa1f07df8752a74e79bbcfb6d49e8a49d517.zip
chromium_src-8bd8aa1f07df8752a74e79bbcfb6d49e8a49d517.tar.gz
chromium_src-8bd8aa1f07df8752a74e79bbcfb6d49e8a49d517.tar.bz2
Tweaks to BoundsAnimator/SlideAnimation and TabStrip:
. Adds unit test for BoundsAnimator and SlideAnimation. . Fixes leak in BoundsAnimator. . Fixes possibility of deleting delegate twice. . Makes sure delegate is notified when new animation is set for view. . Fixes crashes in TabStrip that resulted from dragging a tab back in. BUG=40475 TEST=make sure dragging tabs out/in to a tabstrip doesn't cause problems. Review URL: http://codereview.chromium.org/1585020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43864 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/animation/bounds_animator.h')
-rw-r--r--views/animation/bounds_animator.h24
1 files changed, 14 insertions, 10 deletions
diff --git a/views/animation/bounds_animator.h b/views/animation/bounds_animator.h
index ab2fde9..606c05f 100644
--- a/views/animation/bounds_animator.h
+++ b/views/animation/bounds_animator.h
@@ -50,7 +50,9 @@ class BoundsAnimator : public AnimationDelegate,
// Starts animating |view| from its current bounds to |target|. If
// |delete_when_done| is true the view is deleted when the animation
// completes. If there is already an animation running for the view it's
- // stopped and a new one started.
+ // stopped and a new one started. If an AnimationDelegate has been set for
+ // |view| it is removed (after being notified that the animation was
+ // canceled).
void AnimateViewTo(View* view,
const gfx::Rect& target,
bool delete_when_done);
@@ -64,7 +66,7 @@ class BoundsAnimator : public AnimationDelegate,
const SlideAnimation* GetAnimationForView(View* view);
// Stops animating the specified view. If the view was scheduled for deletion
- // it is deleted.
+ // it is deleted. This does nothing if |view| is not currently animating.
void StopAnimatingView(View* view);
// Sets the delegate for the animation created for the specified view. If
@@ -88,6 +90,10 @@ class BoundsAnimator : public AnimationDelegate,
observer_ = observer;
}
+ protected:
+ // Creates the animation to use for animating views.
+ virtual SlideAnimation* CreateAnimation();
+
private:
// Tracks data about the view being animated.
struct Data {
@@ -120,15 +126,13 @@ class BoundsAnimator : public AnimationDelegate,
typedef std::map<const Animation*, View*> AnimationToViewMap;
- // Creates the animation to use for animating views.
- SlideAnimation* CreateAnimation();
-
- // Removes references to |view| and its animation as well as deleting |view|
- // (if necessary). This does NOT delete the animation or delegate.
- void RemoveFromMapsAndDelete(View* view);
+ // Removes references to |view| and its animation. This does NOT delete the
+ // animation or delegate.
+ void RemoveFromMaps(View* view);
- // Does the necessary cleanup for |data|.
- void CleanupData(Data* data);
+ // Does the necessary cleanup for |data|. If |send_cancel| is true and a
+ // delegate has been installed on |data| AnimationCanceled is invoked on it.
+ void CleanupData(bool send_cancel, Data* data, View* view);
// Used when changing the animation for a view. This resets the maps for
// the animation used by view and returns the current animation. Ownership