Index: ash/drag_drop/drag_drop_controller.cc |
=================================================================== |
--- ash/drag_drop/drag_drop_controller.cc (revision 120096) |
+++ ash/drag_drop/drag_drop_controller.cc (working copy) |
@@ -28,7 +28,7 @@ |
const gfx::Point kDragDropWidgetOffset(0, 0); |
const base::TimeDelta kDragDropAnimationDuration = |
base::TimeDelta::FromMilliseconds(250); |
-} // namespace |
+} |
//////////////////////////////////////////////////////////////////////////////// |
// DragDropController, public: |
@@ -47,8 +47,11 @@ |
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,23 +206,26 @@ |
//////////////////////////////////////////////////////////////////////////////// |
// 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(); |
+} |
+ |
void DragDropController::StartCanceledAnimation() { |
aura::Window* window = drag_image_->GetWidget()->GetNativeView(); |
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())); |
} |