diff options
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, 23 insertions, 12 deletions
diff --git a/ash/drag_drop/drag_drop_controller.cc b/ash/drag_drop/drag_drop_controller.cc index 255b0e2..2e43ea3 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,8 +47,11 @@ DragDropController::DragDropController() DragDropController::~DragDropController() { Shell::GetInstance()->RemoveRootWindowEventFilter(this); Cleanup(); - if (drag_image_.get()) + if (drag_image_.get()) { + aura::Window* window = drag_image_->GetWidget()->GetNativeView(); + window->layer()->GetAnimator()->RemoveObserver(this); drag_image_.reset(); + } } int DragDropController::StartDragAndDrop(const ui::OSExchangeData& data, @@ -203,7 +206,14 @@ ui::GestureStatus DragDropController::PreHandleGestureEvent( //////////////////////////////////////////////////////////////////////////////// // DragDropController, private: -void DragDropController::OnImplicitAnimationsCompleted() { +void DragDropController::OnLayerAnimationEnded( + const ui::LayerAnimationSequence* sequence) { + DCHECK(drag_image_.get()); + drag_image_.reset(); +} + +void DragDropController::OnLayerAnimationAborted( + const ui::LayerAnimationSequence* sequence) { DCHECK(drag_image_.get()); drag_image_.reset(); } @@ -213,13 +223,9 @@ void DragDropController::StartCanceledAnimation() { ui::LayerAnimator* animator = window->layer()->GetAnimator(); animator->set_preemption_strategy( ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); - - // Stop waiting for any as yet unfinished implicit animations. - StopObservingImplicitAnimations(); - + animator->AddObserver(this); 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 9272257..0f9b257 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::ImplicitAnimationObserver { -public: + public ui::LayerAnimationObserver { + public: DragDropController(); virtual ~DragDropController(); @@ -69,8 +69,13 @@ public: private: friend class ash::test::DragDropControllerTest; - // Implementation of ImplicitAnimationObserver - virtual void OnImplicitAnimationsCompleted() OVERRIDE; + // 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 {} // Helper method to start drag widget flying back animation. void StartCanceledAnimation(); |