diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-15 12:25:33 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-15 12:25:33 +0000 |
commit | 5532776735c3b4b10950a31729e99b8015be28df (patch) | |
tree | 05c880732831a7eef24baf0088043794b2b5fdf0 | |
parent | 891441f8ffdefa94574b4083b008f67ac5f81be0 (diff) | |
download | chromium_src-5532776735c3b4b10950a31729e99b8015be28df.zip chromium_src-5532776735c3b4b10950a31729e99b8015be28df.tar.gz chromium_src-5532776735c3b4b10950a31729e99b8015be28df.tar.bz2 |
app: Remove animation header files.
They were moved to ui/base/animation. Remove them now, since no one is including these files.
BUG=None
TEST=trybots
Review URL: http://codereview.chromium.org/6243002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71557 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | app/animation.h | 105 | ||||
-rw-r--r-- | app/animation_container.h | 86 | ||||
-rw-r--r-- | app/animation_container_element.h | 30 | ||||
-rw-r--r-- | app/animation_container_observer.h | 27 | ||||
-rw-r--r-- | app/animation_delegate.h | 30 | ||||
-rw-r--r-- | app/linear_animation.h | 71 | ||||
-rw-r--r-- | app/multi_animation.h | 90 | ||||
-rw-r--r-- | app/slide_animation.h | 96 | ||||
-rw-r--r-- | app/test_animation_delegate.h | 45 | ||||
-rw-r--r-- | app/throb_animation.h | 65 |
10 files changed, 0 insertions, 645 deletions
diff --git a/app/animation.h b/app/animation.h deleted file mode 100644 index 5affe61..0000000 --- a/app/animation.h +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) 2010 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. - -#ifndef APP_ANIMATION_H_ -#define APP_ANIMATION_H_ -#pragma once - -#include "app/animation_container_element.h" -#include "base/ref_counted.h" -#include "base/time.h" - -namespace gfx { -class Rect; -} - -class AnimationContainer; -class AnimationDelegate; - -// Base class used in implementing animations. You only need use this class if -// you're implementing a new animation type, otherwise you'll likely want one of -// LinearAnimation, SlideAnimation, ThrobAnimation or MultiAnimation. -// -// To subclass override Step, which is invoked as the animation progresses and -// GetCurrentValue() to return the value appropriate to the animation. -class Animation : public AnimationContainerElement { - public: - explicit Animation(base::TimeDelta timer_interval); - virtual ~Animation(); - - // Starts the animation. Does nothing if the animation is already running. - void Start(); - - // Stops the animation. Does nothing if the animation is not running. - void Stop(); - - // Gets the value for the current state, according to the animation - // curve in use. - virtual double GetCurrentValue() const = 0; - - // Convenience for returning a value between |start| and |target| based on - // the current value. This is (target - start) * GetCurrentValue() + start. - double CurrentValueBetween(double start, double target) const; - int CurrentValueBetween(int start, int target) const; - gfx::Rect CurrentValueBetween(const gfx::Rect& start_bounds, - const gfx::Rect& target_bounds) const; - - // Sets the delegate. - void set_delegate(AnimationDelegate* delegate) { delegate_ = delegate; } - - // Sets the container used to manage the timer. A value of NULL results in - // creating a new AnimationContainer. - void SetContainer(AnimationContainer* container); - - bool is_animating() const { return is_animating_; } - - base::TimeDelta timer_interval() const { return timer_interval_; } - - // Returns true if rich animations should be rendered. - // Looks at session type (e.g. remote desktop) and accessibility settings - // to give guidance for heavy animations such as "start download" arrow. - static bool ShouldRenderRichAnimation(); - - protected: - // Invoked from Start to allow subclasses to prepare for the animation. - virtual void AnimationStarted() {} - - // Invoked from Stop after we're removed from the container but before the - // delegate has been invoked. - virtual void AnimationStopped() {} - - // Invoked from stop to determine if cancel should be invoked. If this returns - // true the delegate is notified the animation was canceled, otherwise the - // delegate is notified the animation stopped. - virtual bool ShouldSendCanceledFromStop(); - - AnimationContainer* container() { return container_.get(); } - base::TimeTicks start_time() const { return start_time_; } - AnimationDelegate* delegate() { return delegate_; } - - // AnimationContainer::Element overrides - virtual void SetStartTime(base::TimeTicks start_time); - virtual void Step(base::TimeTicks time_now) = 0; - virtual base::TimeDelta GetTimerInterval() const; - - private: - // Interval for the animation. - const base::TimeDelta timer_interval_; - - // If true we're running. - bool is_animating_; - - // Our delegate; may be null. - AnimationDelegate* delegate_; - - // Container we're in. If non-null we're animating. - scoped_refptr<AnimationContainer> container_; - - // Time we started at. - base::TimeTicks start_time_; - - DISALLOW_COPY_AND_ASSIGN(Animation); -}; - -#endif // APP_ANIMATION_H_ diff --git a/app/animation_container.h b/app/animation_container.h deleted file mode 100644 index 3d92699..0000000 --- a/app/animation_container.h +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) 2010 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. - -#ifndef APP_ANIMATION_CONTAINER_H_ -#define APP_ANIMATION_CONTAINER_H_ -#pragma once - -#include <set> - -#include "base/ref_counted.h" -#include "base/time.h" -#include "base/timer.h" - -class AnimationContainerElement; -class AnimationContainerObserver; - -// AnimationContainer is used by Animation to manage the underlying timer. -// Internally each Animation creates a single AnimationContainer. You can -// group a set of Animations into the same AnimationContainer by way of -// Animation::SetContainer. Grouping a set of Animations into the same -// AnimationContainer ensures they all update and start at the same time. -// -// AnimationContainer is ref counted. Each Animation contained within the -// AnimationContainer own it. -class AnimationContainer : public base::RefCounted<AnimationContainer> { - public: - AnimationContainer(); - - // Invoked by Animation when it needs to start. Starts the timer if necessary. - // NOTE: This is invoked by Animation for you, you shouldn't invoke this - // directly. - void Start(AnimationContainerElement* animation); - - // Invoked by Animation when it needs to stop. If there are no more animations - // running the timer stops. - // NOTE: This is invoked by Animation for you, you shouldn't invoke this - // directly. - void Stop(AnimationContainerElement* animation); - - void set_observer(AnimationContainerObserver* observer) { - observer_ = observer; - } - - // The time the last animation ran at. - base::TimeTicks last_tick_time() const { return last_tick_time_; } - - // Are there any timers running? - bool is_running() const { return !elements_.empty(); } - - private: - friend class base::RefCounted<AnimationContainer>; - - typedef std::set<AnimationContainerElement*> Elements; - - ~AnimationContainer(); - - // Timer callback method. - void Run(); - - // Sets min_timer_interval_ and restarts the timer. - void SetMinTimerInterval(base::TimeDelta delta); - - // Returns the min timer interval of all the timers. - base::TimeDelta GetMinInterval(); - - // Represents one of two possible values: - // . If only a single animation has been started and the timer hasn't yet - // fired this is the time the animation was added. - // . The time the last animation ran at (::Run was invoked). - base::TimeTicks last_tick_time_; - - // Set of elements (animations) being managed. - Elements elements_; - - // Minimum interval the timers run at. - base::TimeDelta min_timer_interval_; - - base::RepeatingTimer<AnimationContainer> timer_; - - AnimationContainerObserver* observer_; - - DISALLOW_COPY_AND_ASSIGN(AnimationContainer); -}; - -#endif // APP_ANIMATION_CONTAINER_H_ diff --git a/app/animation_container_element.h b/app/animation_container_element.h deleted file mode 100644 index 57793f6..0000000 --- a/app/animation_container_element.h +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) 2010 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. - -#ifndef APP_ANIMATION_CONTAINER_ELEMENT_H_ -#define APP_ANIMATION_CONTAINER_ELEMENT_H_ -#pragma once - -#include "base/time.h" - -// Interface for the elements the AnimationContainer contains. This is -// implemented by Animation. -class AnimationContainerElement { - public: - // Sets the start of the animation. This is invoked from - // AnimationContainer::Start. - virtual void SetStartTime(base::TimeTicks start_time) = 0; - - // Invoked when the animation is to progress. - virtual void Step(base::TimeTicks time_now) = 0; - - // Returns the time interval of the animation. If an Element needs to change - // this it should first invoke Stop, then Start. - virtual base::TimeDelta GetTimerInterval() const = 0; - - protected: - virtual ~AnimationContainerElement() {} -}; - -#endif // APP_ANIMATION_CONTAINER_ELEMENT_H_ diff --git a/app/animation_container_observer.h b/app/animation_container_observer.h deleted file mode 100644 index 9f74a91..0000000 --- a/app/animation_container_observer.h +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2010 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. - -#ifndef APP_ANIMATION_CONTAINER_OBSERVER_H_ -#define APP_ANIMATION_CONTAINER_OBSERVER_H_ -#pragma once - -class AnimationContainer; - -// The observer is notified after every update of the animations managed by -// the container. -class AnimationContainerObserver { - public: - // Invoked on every tick of the timer managed by the container and after - // all the animations have updated. - virtual void AnimationContainerProgressed( - AnimationContainer* container) = 0; - - // Invoked when no more animations are being managed by this container. - virtual void AnimationContainerEmpty(AnimationContainer* container) = 0; - - protected: - virtual ~AnimationContainerObserver() {} -}; - -#endif // APP_ANIMATION_CONTAINER_OBSERVER_H_ diff --git a/app/animation_delegate.h b/app/animation_delegate.h deleted file mode 100644 index bed2c9d..0000000 --- a/app/animation_delegate.h +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) 2010 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. - -#ifndef APP_ANIMATION_DELEGATE_H_ -#define APP_ANIMATION_DELEGATE_H_ -#pragma once - -class Animation; - -// AnimationDelegate -// -// Implement this interface when you want to receive notifications about the -// state of an animation. -class AnimationDelegate { - public: - // Called when an animation has completed. - virtual void AnimationEnded(const Animation* animation) {} - - // Called when an animation has progressed. - virtual void AnimationProgressed(const Animation* animation) {} - - // Called when an animation has been canceled. - virtual void AnimationCanceled(const Animation* animation) {} - - protected: - virtual ~AnimationDelegate() {} -}; - -#endif // APP_ANIMATION_DELEGATE_H_ diff --git a/app/linear_animation.h b/app/linear_animation.h deleted file mode 100644 index 72040ae..0000000 --- a/app/linear_animation.h +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) 2010 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. -// Inspired by NSAnimation - -#ifndef APP_LINEAR_ANIMATION_H_ -#define APP_LINEAR_ANIMATION_H_ -#pragma once - -#include "app/animation.h" -#include "base/time.h" - -class AnimationDelegate; - -// Linear time bounded animation. As the animation progresses AnimateToState is -// invoked. -class LinearAnimation : public Animation { - public: - // Initializes everything except the duration. - // - // Caller must make sure to call SetDuration() if they use this - // constructor; it is preferable to use the full one, but sometimes - // duration can change between calls to Start() and we need to - // expose this interface. - LinearAnimation(int frame_rate, AnimationDelegate* delegate); - - // Initializes all fields. - LinearAnimation(int duration, int frame_rate, AnimationDelegate* delegate); - - // Gets the value for the current state, according to the animation curve in - // use. This class provides only for a linear relationship, however subclasses - // can override this to provide others. - virtual double GetCurrentValue() const; - - // Skip to the end of the current animation. - void End(); - - // Changes the length of the animation. This resets the current - // state of the animation to the beginning. - void SetDuration(int duration); - - protected: - // Called when the animation progresses. Subclasses override this to - // efficiently update their state. - virtual void AnimateToState(double state) = 0; - - // Invoked by the AnimationContainer when the animation is running to advance - // the animation. Use |time_now| rather than Time::Now to avoid multiple - // animations running at the same time diverging. - virtual void Step(base::TimeTicks time_now); - - // Overriden to advance to the end (if End was invoked). - virtual void AnimationStopped(); - - // Overriden to return true if state is not 1. - virtual bool ShouldSendCanceledFromStop(); - - private: - base::TimeDelta duration_; - - // Current state, on a scale from 0.0 to 1.0. - double state_; - - // If true, we're in end. This is used to determine if the animation should - // be advanced to the end from AnimationStopped. - bool in_end_; - - DISALLOW_COPY_AND_ASSIGN(LinearAnimation); -}; - -#endif // APP_LINEAR_ANIMATION_H_ diff --git a/app/multi_animation.h b/app/multi_animation.h deleted file mode 100644 index f565000..0000000 --- a/app/multi_animation.h +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) 2010 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. - -#ifndef APP_MULTI_ANIMATION_H_ -#define APP_MULTI_ANIMATION_H_ -#pragma once - -#include <vector> - -#include "app/animation.h" -#include "app/tween.h" - -// MultiAnimation is an animation that consists of a number of sub animations. -// To create a MultiAnimation pass in the parts, invoke Start() and the delegate -// is notified as the animation progresses. By default MultiAnimation runs until -// Stop is invoked, see |set_continuous()| for details. -class MultiAnimation : public Animation { - public: - // Defines part of the animation. Each part consists of the following: - // - // time_ms: the time of the part. - // start_time_ms: the amount of time to offset this part by when calculating - // the percented completed. - // end_time_ms: the end time used to calculate the percentange completed. - // - // In most cases |start_time_ms| = 0 and |end_time_ms| = |time_ms|. But you - // can adjust the start/end for different effects. For example, to run a part - // for 200ms with a % between .25 and .75 use the following three values: 200, - // 100, 400. - struct Part { - Part() : time_ms(0), start_time_ms(0), end_time_ms(0), type(Tween::ZERO) {} - Part(int time_ms, Tween::Type type) - : time_ms(time_ms), - start_time_ms(0), - end_time_ms(time_ms), - type(type) {} - - int time_ms; - int start_time_ms; - int end_time_ms; - Tween::Type type; - }; - - typedef std::vector<Part> Parts; - - explicit MultiAnimation(const Parts& parts); - virtual ~MultiAnimation(); - - // Sets whether the animation continues after it reaches the end. If true, the - // animation runs until explicitly stopped. The default is true. - void set_continuous(bool continuous) { continuous_ = continuous; } - - // Returns the current value. The current value for a MultiAnimation is - // determined from the tween type of the current part. - virtual double GetCurrentValue() const; - - // Returns the index of the current part. - size_t current_part_index() const { return current_part_index_; } - - protected: - // Animation overrides. - virtual void Step(base::TimeTicks time_now); - virtual void SetStartTime(base::TimeTicks start_time); - - private: - // Returns the part containing the specified time. |time_ms| is reset to be - // relative to the part containing the time and |part_index| the index of the - // part. - const Part& GetPart(int* time_ms, size_t* part_index); - - // The parts that make up the animation. - const Parts parts_; - - // Total time of all the parts. - const int cycle_time_ms_; - - // Current value for the animation. - double current_value_; - - // Index of the current part. - size_t current_part_index_; - - // See description above setter. - bool continuous_; - - DISALLOW_COPY_AND_ASSIGN(MultiAnimation); -}; - -#endif // APP_MULTI_ANIMATION_H_ diff --git a/app/slide_animation.h b/app/slide_animation.h deleted file mode 100644 index 7c77445..0000000 --- a/app/slide_animation.h +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) 2010 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. - -#ifndef APP_SLIDE_ANIMATION_H_ -#define APP_SLIDE_ANIMATION_H_ -#pragma once - -#include "app/linear_animation.h" -#include "app/tween.h" - -// Slide Animation -// -// Used for reversible animations and as a general helper class. Typical usage: -// -// #include "app/slide_animation.h" -// -// class MyClass : public AnimationDelegate { -// public: -// MyClass() { -// animation_.reset(new SlideAnimation(this)); -// animation_->SetSlideDuration(500); -// } -// void OnMouseOver() { -// animation_->Show(); -// } -// void OnMouseOut() { -// animation_->Hide(); -// } -// void AnimationProgressed(const Animation* animation) { -// if (animation == animation_.get()) { -// Layout(); -// SchedulePaint(); -// } else if (animation == other_animation_.get()) { -// ... -// } -// } -// void Layout() { -// if (animation_->is_animating()) { -// hover_image_.SetOpacity(animation_->GetCurrentValue()); -// } -// } -// private: -// scoped_ptr<SlideAnimation> animation_; -// } -class SlideAnimation : public LinearAnimation { - public: - explicit SlideAnimation(AnimationDelegate* target); - virtual ~SlideAnimation(); - - // Set the animation back to the 0 state. - virtual void Reset(); - virtual void Reset(double value); - - // Begin a showing animation or reverse a hiding animation in progress. - virtual void Show(); - - // Begin a hiding animation or reverse a showing animation in progress. - virtual void Hide(); - - // Sets the time a slide will take. Note that this isn't actually - // the amount of time an animation will take as the current value of - // the slide is considered. - virtual void SetSlideDuration(int duration); - int GetSlideDuration() const { return slide_duration_; } - void SetTweenType(Tween::Type tween_type) { tween_type_ = tween_type; } - - virtual double GetCurrentValue() const; - bool IsShowing() const { return showing_; } - bool IsClosing() const { return !showing_ && value_end_ < value_current_; } - - private: - // Overridden from Animation. - virtual void AnimateToState(double state); - - AnimationDelegate* target_; - - Tween::Type tween_type_; - - // Used to determine which way the animation is going. - bool showing_; - - // Animation values. These are a layer on top of Animation::state_ to - // provide the reversability. - double value_start_; - double value_end_; - double value_current_; - - // How long a hover in/out animation will last for. This defaults to - // kHoverFadeDurationMS, but can be overridden with SetDuration. - int slide_duration_; - - DISALLOW_COPY_AND_ASSIGN(SlideAnimation); -}; - -#endif // APP_SLIDE_ANIMATION_H_ diff --git a/app/test_animation_delegate.h b/app/test_animation_delegate.h deleted file mode 100644 index 6f17331..0000000 --- a/app/test_animation_delegate.h +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) 2010 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. - -#ifndef APP_TEST_ANIMATION_DELEGATE_H_ -#define APP_TEST_ANIMATION_DELEGATE_H_ -#pragma once - -#include "app/animation_delegate.h" -#include "base/message_loop.h" - -// Trivial AnimationDelegate implementation. AnimationEnded/Canceled quit the -// message loop. -class TestAnimationDelegate : public AnimationDelegate { - public: - TestAnimationDelegate() : canceled_(false), finished_(false) { - } - - virtual void AnimationEnded(const Animation* animation) { - finished_ = true; - MessageLoop::current()->Quit(); - } - - virtual void AnimationCanceled(const Animation* animation) { - finished_ = true; - canceled_ = true; - MessageLoop::current()->Quit(); - } - - bool finished() const { - return finished_; - } - - bool canceled() const { - return canceled_; - } - - private: - bool canceled_; - bool finished_; - - DISALLOW_COPY_AND_ASSIGN(TestAnimationDelegate); -}; - -#endif // APP_TEST_ANIMATION_DELEGATE_H_ diff --git a/app/throb_animation.h b/app/throb_animation.h deleted file mode 100644 index d3ac39e..0000000 --- a/app/throb_animation.h +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) 2006-2008 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. - -#ifndef APP_THROB_ANIMATION_H_ -#define APP_THROB_ANIMATION_H_ -#pragma once - -#include "app/slide_animation.h" - -// A subclass of SlideAnimation that can continually slide. All of the Animation -// methods behave like that of SlideAnimation: transition to the next state. -// The StartThrobbing method causes the ThrobAnimation to cycle between hidden -// and shown for a set number of cycles. -// -// A ThrobAnimation has two durations: the duration used when behavior like -// a SlideAnimation, and the duration used when throbbing. -class ThrobAnimation : public SlideAnimation { - public: - explicit ThrobAnimation(AnimationDelegate* target); - virtual ~ThrobAnimation() {} - - // Starts throbbing. cycles_til_stop gives the number of cycles to do before - // stopping. A negative value means "throb indefinitely". - void StartThrobbing(int cycles_til_stop); - - // Sets the duration of the slide animation when throbbing. - void SetThrobDuration(int duration) { throb_duration_ = duration; } - - // Overridden to reset to the slide duration. - virtual void Reset(); - virtual void Show(); - virtual void Hide(); - - // Overridden to maintain the slide duration. - virtual void SetSlideDuration(int duration); - - // The number of cycles remaining until the animation stops. - void set_cycles_remaining(int value) { cycles_remaining_ = value; } - int cycles_remaining() const { return cycles_remaining_; } - - protected: - // Overriden to continually throb (assuming we're throbbing). - virtual void Step(base::TimeTicks time_now); - - private: - // Resets state such that we behave like SlideAnimation. - void ResetForSlide(); - - // Duration of the slide animation. - int slide_duration_; - - // Duration of the slide animation when throbbing. - int throb_duration_; - - // If throbbing, this is the number of cycles left. - int cycles_remaining_; - - // Are we throbbing? - bool throbbing_; - - DISALLOW_COPY_AND_ASSIGN(ThrobAnimation); -}; - -#endif // APP_THROB_ANIMATION_H_ |