Index: ash/drag_drop/drag_drop_controller.cc |
diff --git a/ash/drag_drop/drag_drop_controller.cc b/ash/drag_drop/drag_drop_controller.cc |
index 2e43ea3813afe169f27e32a3c06039fb1dd64f76..255b0e2f13451e54b8ccdc49a7ccfb0fa3d05e2b 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() { |
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())); |
} |