diff options
author | vollick@google.com <vollick@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-01 17:19:22 +0000 |
---|---|---|
committer | vollick@google.com <vollick@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-01 17:19:22 +0000 |
commit | c3287f6e7f7c23c1f20729d4729ffdd84658c4b7 (patch) | |
tree | d3cd8bb3f63836aaa4058e2834c8ba28791ffc23 /ash/drag_drop | |
parent | 32b9c269a98692acf748f7594425d586e838cf96 (diff) | |
download | chromium_src-c3287f6e7f7c23c1f20729d4729ffdd84658c4b7.zip chromium_src-c3287f6e7f7c23c1f20729d4729ffdd84658c4b7.tar.gz chromium_src-c3287f6e7f7c23c1f20729d4729ffdd84658c4b7.tar.bz2 |
Disable animations during aura tests.
This causes all animations scheduled during a test to complete immediately.
After making this change, I noticed some code assumed that animations would not complete synchronously. Some of this code used animation observers, and I while fixing the code I have updated it to use the preferred ImplicitAnimationObserver.
BUG=None
TEST=aura_shell_unittests,aura_unittests,compositor_unittests
Review URL: https://chromiumcodereview.appspot.com/9222018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@120074 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/drag_drop')
-rw-r--r-- | ash/drag_drop/drag_drop_controller.cc | 22 | ||||
-rw-r--r-- | ash/drag_drop/drag_drop_controller.h | 13 |
2 files changed, 12 insertions, 23 deletions
diff --git a/ash/drag_drop/drag_drop_controller.cc b/ash/drag_drop/drag_drop_controller.cc index 2e43ea3..c3ca96a 100644 --- a/ash/drag_drop/drag_drop_controller.cc +++ b/ash/drag_drop/drag_drop_controller.cc @@ -28,7 +28,7 @@ namespace { const gfx::Point kDragDropWidgetOffset(0, 0); const base::TimeDelta kDragDropAnimationDuration = base::TimeDelta::FromMilliseconds(250); -} +} // namespace //////////////////////////////////////////////////////////////////////////////// // DragDropController, public: @@ -47,11 +47,8 @@ DragDropController::DragDropController() DragDropController::~DragDropController() { Shell::GetInstance()->RemoveRootWindowEventFilter(this); Cleanup(); - if (drag_image_.get()) { - aura::Window* window = drag_image_->GetWidget()->GetNativeView(); - window->layer()->GetAnimator()->RemoveObserver(this); + if (drag_image_.get()) drag_image_.reset(); - } } int DragDropController::StartDragAndDrop(const ui::OSExchangeData& data, @@ -206,14 +203,7 @@ ui::GestureStatus DragDropController::PreHandleGestureEvent( //////////////////////////////////////////////////////////////////////////////// // DragDropController, private: -void DragDropController::OnLayerAnimationEnded( - const ui::LayerAnimationSequence* sequence) { - DCHECK(drag_image_.get()); - drag_image_.reset(); -} - -void DragDropController::OnLayerAnimationAborted( - const ui::LayerAnimationSequence* sequence) { +void DragDropController::OnImplicitAnimationsCompleted() OVERRIDE { DCHECK(drag_image_.get()); drag_image_.reset(); } @@ -223,9 +213,13 @@ void DragDropController::StartCanceledAnimation() { ui::LayerAnimator* animator = window->layer()->GetAnimator(); animator->set_preemption_strategy( ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); - animator->AddObserver(this); + + // Stop waiting for any as yet unfinished implicit animations. + StopObservingImplicitAnimations(); + ui::ScopedLayerAnimationSettings animation_setter(animator); animation_setter.SetTransitionDuration(kDragDropAnimationDuration); + animation_setter.AddObserver(this); window->SetBounds(gfx::Rect(drag_start_location_, window->bounds().size())); } diff --git a/ash/drag_drop/drag_drop_controller.h b/ash/drag_drop/drag_drop_controller.h index 0f9b257..9272257 100644 --- a/ash/drag_drop/drag_drop_controller.h +++ b/ash/drag_drop/drag_drop_controller.h @@ -36,8 +36,8 @@ class DragImageView; class ASH_EXPORT DragDropController : public aura::client::DragDropClient, public aura::EventFilter, - public ui::LayerAnimationObserver { - public: + public ui::ImplicitAnimationObserver { +public: DragDropController(); virtual ~DragDropController(); @@ -69,13 +69,8 @@ class ASH_EXPORT DragDropController private: friend class ash::test::DragDropControllerTest; - // Overridden from ui::LayerAnimationObserver: - virtual void OnLayerAnimationEnded( - const ui::LayerAnimationSequence* sequence) OVERRIDE; - virtual void OnLayerAnimationAborted( - const ui::LayerAnimationSequence* sequence) OVERRIDE; - virtual void OnLayerAnimationScheduled( - const ui::LayerAnimationSequence* sequence) OVERRIDE {} + // Implementation of ImplicitAnimationObserver + virtual void OnImplicitAnimationsCompleted() OVERRIDE; // Helper method to start drag widget flying back animation. void StartCanceledAnimation(); |