Commit 80823ac2 authored by Alan Cutter's avatar Alan Cutter Committed by Commit Bot

Remove unnecessary virtualization of BoundsAnimator::CreateAnimation()

The method BoundsAnimator::CreateAnimation() is only overridden by a test
class that doesn't really need to do so. This CL removes the test subclass
and the virtual keyword from CreateAnimation().
This is a code clean up and has no change in behaviour.

Change-Id: I633f1163125cca423da4aff54ffafc0922bf0658
Reviewed-on: https://chromium-review.googlesource.com/895207Reviewed-by: default avatarTrent Apted <tapted@chromium.org>
Commit-Queue: Alan Cutter <alancutter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533531}
parent 3ce9c7d3
......@@ -96,10 +96,6 @@ class VIEWS_EXPORT BoundsAnimator : public gfx::AnimationDelegate,
void AddObserver(BoundsAnimatorObserver* observer);
void RemoveObserver(BoundsAnimatorObserver* observer);
protected:
// Creates the animation to use for animating views.
virtual gfx::SlideAnimation* CreateAnimation();
private:
// Tracks data about the view being animated.
struct Data {
......@@ -128,6 +124,9 @@ class VIEWS_EXPORT BoundsAnimator : public gfx::AnimationDelegate,
typedef std::map<const gfx::Animation*, View*> AnimationToViewMap;
// Creates the animation to use for animating views.
gfx::SlideAnimation* CreateAnimation();
// Removes references to |view| and its animation. This does NOT delete the
// animation or delegate.
void RemoveFromMaps(View* view);
......
......@@ -19,22 +19,6 @@ using gfx::TestAnimationDelegate;
namespace views {
namespace {
class TestBoundsAnimator : public BoundsAnimator {
public:
explicit TestBoundsAnimator(View* view) : BoundsAnimator(view) {
}
protected:
SlideAnimation* CreateAnimation() override {
SlideAnimation* animation = BoundsAnimator::CreateAnimation();
animation->SetSlideDuration(10);
return animation;
}
private:
DISALLOW_COPY_AND_ASSIGN(TestBoundsAnimator);
};
class OwnedDelegate : public gfx::AnimationDelegate {
public:
OwnedDelegate() {}
......@@ -98,17 +82,18 @@ class BoundsAnimatorTest : public testing::Test {
child_(new TestView()),
animator_(&parent_) {
parent_.AddChildView(child_);
animator_.SetAnimationDuration(10);
}
TestView* parent() { return &parent_; }
TestView* child() { return child_; }
TestBoundsAnimator* animator() { return &animator_; }
BoundsAnimator* animator() { return &animator_; }
private:
base::test::ScopedTaskEnvironment scoped_task_environment_;
TestView parent_;
TestView* child_; // Owned by |parent_|.
TestBoundsAnimator animator_;
BoundsAnimator animator_;
DISALLOW_COPY_AND_ASSIGN(BoundsAnimatorTest);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment