diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-07 17:33:39 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-07 17:33:39 +0000 |
commit | f676780687464428e340d008a0d1ca13d9944628 (patch) | |
tree | 489e8bd8188e31a7f6c53f15e8d1d9c6ba36d023 /views | |
parent | 3b65bfd55c56cf8a6db025087d937494f49dc15f (diff) | |
download | chromium_src-f676780687464428e340d008a0d1ca13d9944628.zip chromium_src-f676780687464428e340d008a0d1ca13d9944628.tar.gz chromium_src-f676780687464428e340d008a0d1ca13d9944628.tar.bz2 |
Move animation code to new ui/base/animation directory.
BUG=none
TEST=none
TBR=brettw
Review URL: http://codereview.chromium.org/6154001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70743 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/animation/bounds_animator.cc | 9 | ||||
-rw-r--r-- | views/animation/bounds_animator.h | 47 | ||||
-rw-r--r-- | views/animation/bounds_animator_unittest.cc | 6 | ||||
-rw-r--r-- | views/controls/button/custom_button.cc | 8 | ||||
-rw-r--r-- | views/controls/button/custom_button.h | 12 | ||||
-rw-r--r-- | views/controls/button/image_button.cc | 2 | ||||
-rw-r--r-- | views/controls/button/text_button.cc | 2 |
7 files changed, 48 insertions, 38 deletions
diff --git a/views/animation/bounds_animator.cc b/views/animation/bounds_animator.cc index ad17ec9..4ba8d86 100644 --- a/views/animation/bounds_animator.cc +++ b/views/animation/bounds_animator.cc @@ -4,14 +4,19 @@ #include "views/animation/bounds_animator.h" -#include "app/animation_container.h" -#include "app/slide_animation.h" #include "base/scoped_ptr.h" +#include "ui/base/animation/animation_container.h" +#include "ui/base/animation/slide_animation.h" #include "views/view.h" // Duration in milliseconds for animations. static const int kAnimationDuration = 200; +using ui::Animation; +using ui::AnimationContainer; +using ui::SlideAnimation; +using ui::Tween; + namespace views { BoundsAnimator::BoundsAnimator(View* parent) diff --git a/views/animation/bounds_animator.h b/views/animation/bounds_animator.h index 5e5d976..a2fed4e 100644 --- a/views/animation/bounds_animator.h +++ b/views/animation/bounds_animator.h @@ -8,13 +8,14 @@ #include <map> -#include "app/animation_container_observer.h" -#include "app/animation_delegate.h" #include "base/ref_counted.h" #include "gfx/rect.h" +#include "ui/base/animation/animation_container_observer.h" +#include "ui/base/animation/animation_delegate.h" -class AnimationContainer; +namespace ui { class SlideAnimation; +} namespace views { @@ -37,12 +38,12 @@ class BoundsAnimatorObserver { // You can attach an AnimationDelegate to the individual animation for a view // by way of SetAnimationDelegate. Additionally you can attach an observer to // the BoundsAnimator that is notified when all animations are complete. -class BoundsAnimator : public AnimationDelegate, - public AnimationContainerObserver { +class BoundsAnimator : public ui::AnimationDelegate, + public ui::AnimationContainerObserver { public: // If |delete_when_done| is set to true in |SetAnimationDelegate| the // |AnimationDelegate| must subclass this class. - class OwnedAnimationDelegate : public AnimationDelegate { + class OwnedAnimationDelegate : public ui::AnimationDelegate { public: virtual ~OwnedAnimationDelegate() {} }; @@ -58,11 +59,11 @@ class BoundsAnimator : public AnimationDelegate, // Sets the animation for the specified view. BoundsAnimator takes ownership // of the specified animation. - void SetAnimationForView(View* view, SlideAnimation* animation); + void SetAnimationForView(View* view, ui::SlideAnimation* animation); // Returns the animation for the specified view. BoundsAnimator owns the // returned Animation. - const SlideAnimation* GetAnimationForView(View* view); + const ui::SlideAnimation* GetAnimationForView(View* view); // Stops animating the specified view. If the view was scheduled for deletion // it is deleted. This does nothing if |view| is not currently animating. @@ -72,7 +73,7 @@ class BoundsAnimator : public AnimationDelegate, // |delete_when_done| is true the |delegate| is deleted when done and // |delegate| must subclass OwnedAnimationDelegate. void SetAnimationDelegate(View* view, - AnimationDelegate* delegate, + ui::AnimationDelegate* delegate, bool delete_when_done); // Returns true if BoundsAnimator is animating the bounds of |view|. @@ -91,7 +92,7 @@ class BoundsAnimator : public AnimationDelegate, protected: // Creates the animation to use for animating views. - virtual SlideAnimation* CreateAnimation(); + virtual ui::SlideAnimation* CreateAnimation(); private: // Tracks data about the view being animated. @@ -111,10 +112,10 @@ class BoundsAnimator : public AnimationDelegate, gfx::Rect target_bounds; // The animation. We own this. - SlideAnimation* animation; + ui::SlideAnimation* animation; // Additional delegate for the animation, may be null. - AnimationDelegate* delegate; + ui::AnimationDelegate* delegate; }; // Used by AnimationEndedOrCanceled. @@ -125,7 +126,7 @@ class BoundsAnimator : public AnimationDelegate, typedef std::map<View*, Data> ViewToDataMap; - typedef std::map<const Animation*, View*> AnimationToViewMap; + typedef std::map<const ui::Animation*, View*> AnimationToViewMap; // Removes references to |view| and its animation. This does NOT delete the // animation or delegate. @@ -138,20 +139,20 @@ class BoundsAnimator : public AnimationDelegate, // Used when changing the animation for a view. This resets the maps for // the animation used by view and returns the current animation. Ownership // of the returned animation passes to the caller. - Animation* ResetAnimationForView(View* view); + ui::Animation* ResetAnimationForView(View* view); // Invoked from AnimationEnded and AnimationCanceled. - void AnimationEndedOrCanceled(const Animation* animation, + void AnimationEndedOrCanceled(const ui::Animation* animation, AnimationEndType type); - // AnimationDelegate overrides. - virtual void AnimationProgressed(const Animation* animation); - virtual void AnimationEnded(const Animation* animation); - virtual void AnimationCanceled(const Animation* animation); + // ui::AnimationDelegate overrides. + virtual void AnimationProgressed(const ui::Animation* animation); + virtual void AnimationEnded(const ui::Animation* animation); + virtual void AnimationCanceled(const ui::Animation* animation); - // AnimationContainerObserver overrides. - virtual void AnimationContainerProgressed(AnimationContainer* container); - virtual void AnimationContainerEmpty(AnimationContainer* container); + // ui::AnimationContainerObserver overrides. + virtual void AnimationContainerProgressed(ui::AnimationContainer* container); + virtual void AnimationContainerEmpty(ui::AnimationContainer* container); // Parent of all views being animated. View* parent_; @@ -159,7 +160,7 @@ class BoundsAnimator : public AnimationDelegate, BoundsAnimatorObserver* observer_; // All animations we create up with the same container. - scoped_refptr<AnimationContainer> container_; + scoped_refptr<ui::AnimationContainer> container_; // Maps from view being animated to info about the view. ViewToDataMap data_; diff --git a/views/animation/bounds_animator_unittest.cc b/views/animation/bounds_animator_unittest.cc index d85b185..0c02e2d 100644 --- a/views/animation/bounds_animator_unittest.cc +++ b/views/animation/bounds_animator_unittest.cc @@ -2,13 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "app/slide_animation.h" -#include "app/test_animation_delegate.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/base/animation/slide_animation.h" +#include "ui/base/animation/test_animation_delegate.h" #include "views/animation/bounds_animator.h" #include "views/view.h" using views::BoundsAnimator; +using ui::Animation; +using ui::SlideAnimation; namespace { diff --git a/views/controls/button/custom_button.cc b/views/controls/button/custom_button.cc index 7a3eca2..baf0209 100644 --- a/views/controls/button/custom_button.cc +++ b/views/controls/button/custom_button.cc @@ -5,7 +5,7 @@ #include "views/controls/button/custom_button.h" #include "app/keyboard_codes.h" -#include "app/throb_animation.h" +#include "ui/base/animation/throb_animation.h" #include "views/screen.h" namespace views { @@ -120,7 +120,7 @@ CustomButton::CustomButton(ButtonListener* listener) is_throbbing_(false), triggerable_event_flags_(MouseEvent::EF_LEFT_BUTTON_DOWN), request_focus_on_press_(true) { - hover_animation_.reset(new ThrobAnimation(this)); + hover_animation_.reset(new ui::ThrobAnimation(this)); hover_animation_->SetSlideDuration(kHoverFadeDurationMs); } @@ -262,9 +262,9 @@ void CustomButton::WillLoseFocus() { } //////////////////////////////////////////////////////////////////////////////// -// CustomButton, AnimationDelegate implementation: +// CustomButton, ui::AnimationDelegate implementation: -void CustomButton::AnimationProgressed(const Animation* animation) { +void CustomButton::AnimationProgressed(const ui::Animation* animation) { SchedulePaint(); } diff --git a/views/controls/button/custom_button.h b/views/controls/button/custom_button.h index 6e35a3f..e0dcb2b 100644 --- a/views/controls/button/custom_button.h +++ b/views/controls/button/custom_button.h @@ -6,10 +6,12 @@ #define VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ #pragma once -#include "app/animation_delegate.h" #include "views/controls/button/button.h" +#include "ui/base/animation/animation_delegate.h" +namespace ui { class ThrobAnimation; +} namespace views { @@ -19,7 +21,7 @@ namespace views { // part of the focus chain. Call SetFocusable(true) to make it part of the // focus chain. class CustomButton : public Button, - public AnimationDelegate { + public ui::AnimationDelegate { public: // The menu button's class name. static const char kViewClassName[]; @@ -104,8 +106,8 @@ class CustomButton : public Button, virtual bool IsHotTracked() const; virtual void WillLoseFocus(); - // Overridden from AnimationDelegate: - virtual void AnimationProgressed(const Animation* animation); + // Overridden from ui::AnimationDelegate: + virtual void AnimationProgressed(const ui::Animation* animation); // Returns true if the button should become pressed when the user // holds the mouse down over the button. For this implementation, @@ -116,7 +118,7 @@ class CustomButton : public Button, ButtonState state_; // Hover animation. - scoped_ptr<ThrobAnimation> hover_animation_; + scoped_ptr<ui::ThrobAnimation> hover_animation_; private: // Should we animate when the state changes? Defaults to true. diff --git a/views/controls/button/image_button.cc b/views/controls/button/image_button.cc index 362b7abe..306633e 100644 --- a/views/controls/button/image_button.cc +++ b/views/controls/button/image_button.cc @@ -4,9 +4,9 @@ #include "views/controls/button/image_button.h" -#include "app/throb_animation.h" #include "gfx/canvas.h" #include "gfx/skbitmap_operations.h" +#include "ui/base/animation/throb_animation.h" namespace views { diff --git a/views/controls/button/text_button.cc b/views/controls/button/text_button.cc index 1df698a..4c3460f 100644 --- a/views/controls/button/text_button.cc +++ b/views/controls/button/text_button.cc @@ -6,11 +6,11 @@ #include <algorithm> -#include "app/throb_animation.h" #include "app/resource_bundle.h" #include "base/logging.h" #include "base/utf_string_conversions.h" #include "gfx/canvas_skia.h" +#include "ui/base/animation/throb_animation.h" #include "views/controls/button/button.h" #include "views/event.h" #include "grit/app_resources.h" |