diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-17 23:20:53 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-17 23:20:53 +0000 |
commit | 66c0a651a423da5e80d614de17f463b12b6145ac (patch) | |
tree | c55cdfbf9eeadcad2e72f501bd496afcce79ad9d /app | |
parent | a2b600c5b2175571888da48f76adec7bc80b8b9d (diff) | |
download | chromium_src-66c0a651a423da5e80d614de17f463b12b6145ac.zip chromium_src-66c0a651a423da5e80d614de17f463b12b6145ac.tar.gz chromium_src-66c0a651a423da5e80d614de17f463b12b6145ac.tar.bz2 |
Pulls AnimationDelegate out into its own header.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/5121004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66541 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r-- | app/animation.cc | 1 | ||||
-rw-r--r-- | app/animation.h | 24 | ||||
-rw-r--r-- | app/animation_delegate.h | 30 | ||||
-rw-r--r-- | app/animation_unittest.cc | 4 | ||||
-rw-r--r-- | app/linear_animation.cc | 2 | ||||
-rw-r--r-- | app/multi_animation.cc | 2 | ||||
-rw-r--r-- | app/test_animation_delegate.h | 2 |
7 files changed, 40 insertions, 25 deletions
diff --git a/app/animation.cc b/app/animation.cc index edb1232..40f53f9 100644 --- a/app/animation.cc +++ b/app/animation.cc @@ -4,6 +4,7 @@ #include "app/animation.h" +#include "app/animation_delegate.h" #include "app/tween.h" #include "gfx/rect.h" diff --git a/app/animation.h b/app/animation.h index 8433f29..06ccf52 100644 --- a/app/animation.h +++ b/app/animation.h @@ -14,29 +14,7 @@ namespace gfx { class Rect; } -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() {} -}; +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 diff --git a/app/animation_delegate.h b/app/animation_delegate.h new file mode 100644 index 0000000..bed2c9d --- /dev/null +++ b/app/animation_delegate.h @@ -0,0 +1,30 @@ +// 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/animation_unittest.cc b/app/animation_unittest.cc index 280e74f..a4ab2fe 100644 --- a/app/animation_unittest.cc +++ b/app/animation_unittest.cc @@ -2,12 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "app/animation_delegate.h" #include "app/linear_animation.h" #include "app/test_animation_delegate.h" +#include "testing/gtest/include/gtest/gtest.h" + #if defined(OS_WIN) #include "base/win/windows_version.h" #endif -#include "testing/gtest/include/gtest/gtest.h" class AnimationTest: public testing::Test { private: diff --git a/app/linear_animation.cc b/app/linear_animation.cc index 93b2a81..533a435 100644 --- a/app/linear_animation.cc +++ b/app/linear_animation.cc @@ -6,6 +6,8 @@ #include <math.h> +#include "app/animation_delegate.h" + using base::Time; using base::TimeDelta; diff --git a/app/multi_animation.cc b/app/multi_animation.cc index 812a668..3ba6715 100644 --- a/app/multi_animation.cc +++ b/app/multi_animation.cc @@ -4,6 +4,8 @@ #include "app/multi_animation.h" +#include "app/animation_delegate.h" + // Default interval, in ms. static const int kDefaultInterval = 20; diff --git a/app/test_animation_delegate.h b/app/test_animation_delegate.h index c88aa9f..6f17331 100644 --- a/app/test_animation_delegate.h +++ b/app/test_animation_delegate.h @@ -6,7 +6,7 @@ #define APP_TEST_ANIMATION_DELEGATE_H_ #pragma once -#include "app/animation.h" +#include "app/animation_delegate.h" #include "base/message_loop.h" // Trivial AnimationDelegate implementation. AnimationEnded/Canceled quit the |