summaryrefslogtreecommitdiffstats
path: root/ash/drag_drop
diff options
context:
space:
mode:
authorvollick@google.com <vollick@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-01 17:37:47 +0000
committervollick@google.com <vollick@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-01 17:37:47 +0000
commit83502cddd203d8971ce3883960afca6cfac9fdb1 (patch)
tree952b84d47b9d883457b7c337325335794c0badfc /ash/drag_drop
parentc3287f6e7f7c23c1f20729d4729ffdd84658c4b7 (diff)
downloadchromium_src-83502cddd203d8971ce3883960afca6cfac9fdb1.zip
chromium_src-83502cddd203d8971ce3883960afca6cfac9fdb1.tar.gz
chromium_src-83502cddd203d8971ce3883960afca6cfac9fdb1.tar.bz2
Revert 120074 - 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 TBR=vollick@google.com Review URL: https://chromiumcodereview.appspot.com/9316039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@120075 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/drag_drop')
-rw-r--r--ash/drag_drop/drag_drop_controller.cc22
-rw-r--r--ash/drag_drop/drag_drop_controller.h13
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 c3ca96a..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() OVERRIDE {
+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();