Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(414)

Side by Side Diff: ash/drag_drop/drag_drop_controller.cc

Issue 9320018: Revert 120092 - Reland 120074 -- Disable animations during aura tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/drag_drop/drag_drop_controller.h ('k') | ash/test/aura_shell_test_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/drag_drop/drag_drop_controller.h" 5 #include "ash/drag_drop/drag_drop_controller.h"
6 6
7 #include "ash/drag_drop/drag_image_view.h" 7 #include "ash/drag_drop/drag_image_view.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "ui/aura/client/drag_drop_delegate.h" 10 #include "ui/aura/client/drag_drop_delegate.h"
(...skipping 10 matching lines...) Expand all
21 21
22 namespace ash { 22 namespace ash {
23 namespace internal { 23 namespace internal {
24 24
25 using aura::RootWindow; 25 using aura::RootWindow;
26 26
27 namespace { 27 namespace {
28 const gfx::Point kDragDropWidgetOffset(0, 0); 28 const gfx::Point kDragDropWidgetOffset(0, 0);
29 const base::TimeDelta kDragDropAnimationDuration = 29 const base::TimeDelta kDragDropAnimationDuration =
30 base::TimeDelta::FromMilliseconds(250); 30 base::TimeDelta::FromMilliseconds(250);
31 } // namespace 31 }
32 32
33 //////////////////////////////////////////////////////////////////////////////// 33 ////////////////////////////////////////////////////////////////////////////////
34 // DragDropController, public: 34 // DragDropController, public:
35 35
36 DragDropController::DragDropController() 36 DragDropController::DragDropController()
37 : drag_image_(NULL), 37 : drag_image_(NULL),
38 drag_data_(NULL), 38 drag_data_(NULL),
39 drag_operation_(0), 39 drag_operation_(0),
40 dragged_window_(NULL), 40 dragged_window_(NULL),
41 drag_drop_in_progress_(false), 41 drag_drop_in_progress_(false),
42 should_block_during_drag_drop_(true) { 42 should_block_during_drag_drop_(true) {
43 Shell::GetInstance()->AddRootWindowEventFilter(this); 43 Shell::GetInstance()->AddRootWindowEventFilter(this);
44 aura::client::SetDragDropClient(this); 44 aura::client::SetDragDropClient(this);
45 } 45 }
46 46
47 DragDropController::~DragDropController() { 47 DragDropController::~DragDropController() {
48 Shell::GetInstance()->RemoveRootWindowEventFilter(this); 48 Shell::GetInstance()->RemoveRootWindowEventFilter(this);
49 Cleanup(); 49 Cleanup();
50 if (drag_image_.get()) 50 if (drag_image_.get()) {
51 aura::Window* window = drag_image_->GetWidget()->GetNativeView();
52 window->layer()->GetAnimator()->RemoveObserver(this);
51 drag_image_.reset(); 53 drag_image_.reset();
54 }
52 } 55 }
53 56
54 int DragDropController::StartDragAndDrop(const ui::OSExchangeData& data, 57 int DragDropController::StartDragAndDrop(const ui::OSExchangeData& data,
55 int operation) { 58 int operation) {
56 DCHECK(!drag_drop_in_progress_); 59 DCHECK(!drag_drop_in_progress_);
57 aura::Window* capture_window = RootWindow::GetInstance()->capture_window(); 60 aura::Window* capture_window = RootWindow::GetInstance()->capture_window();
58 if (capture_window) 61 if (capture_window)
59 RootWindow::GetInstance()->ReleaseCapture(capture_window); 62 RootWindow::GetInstance()->ReleaseCapture(capture_window);
60 drag_drop_in_progress_ = true; 63 drag_drop_in_progress_ = true;
61 64
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 199
197 ui::GestureStatus DragDropController::PreHandleGestureEvent( 200 ui::GestureStatus DragDropController::PreHandleGestureEvent(
198 aura::Window* target, 201 aura::Window* target,
199 aura::GestureEvent* event) { 202 aura::GestureEvent* event) {
200 return ui::GESTURE_STATUS_UNKNOWN; 203 return ui::GESTURE_STATUS_UNKNOWN;
201 } 204 }
202 205
203 //////////////////////////////////////////////////////////////////////////////// 206 ////////////////////////////////////////////////////////////////////////////////
204 // DragDropController, private: 207 // DragDropController, private:
205 208
206 void DragDropController::OnImplicitAnimationsCompleted() { 209 void DragDropController::OnLayerAnimationEnded(
210 const ui::LayerAnimationSequence* sequence) {
211 DCHECK(drag_image_.get());
212 drag_image_.reset();
213 }
214
215 void DragDropController::OnLayerAnimationAborted(
216 const ui::LayerAnimationSequence* sequence) {
207 DCHECK(drag_image_.get()); 217 DCHECK(drag_image_.get());
208 drag_image_.reset(); 218 drag_image_.reset();
209 } 219 }
210 220
211 void DragDropController::StartCanceledAnimation() { 221 void DragDropController::StartCanceledAnimation() {
212 aura::Window* window = drag_image_->GetWidget()->GetNativeView(); 222 aura::Window* window = drag_image_->GetWidget()->GetNativeView();
213 ui::LayerAnimator* animator = window->layer()->GetAnimator(); 223 ui::LayerAnimator* animator = window->layer()->GetAnimator();
214 animator->set_preemption_strategy( 224 animator->set_preemption_strategy(
215 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); 225 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
216 226 animator->AddObserver(this);
217 // Stop waiting for any as yet unfinished implicit animations.
218 StopObservingImplicitAnimations();
219
220 ui::ScopedLayerAnimationSettings animation_setter(animator); 227 ui::ScopedLayerAnimationSettings animation_setter(animator);
221 animation_setter.SetTransitionDuration(kDragDropAnimationDuration); 228 animation_setter.SetTransitionDuration(kDragDropAnimationDuration);
222 animation_setter.AddObserver(this);
223 window->SetBounds(gfx::Rect(drag_start_location_, window->bounds().size())); 229 window->SetBounds(gfx::Rect(drag_start_location_, window->bounds().size()));
224 } 230 }
225 231
226 void DragDropController::Cleanup() { 232 void DragDropController::Cleanup() {
227 drag_data_ = NULL; 233 drag_data_ = NULL;
228 drag_drop_in_progress_ = false; 234 drag_drop_in_progress_ = false;
229 } 235 }
230 236
231 } // namespace internal 237 } // namespace internal
232 } // namespace ash 238 } // namespace ash
OLDNEW
« no previous file with comments | « ash/drag_drop/drag_drop_controller.h ('k') | ash/test/aura_shell_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698