| OLD | NEW |
| 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/wm/toplevel_window_event_handler.h" | 5 #include "ash/wm/toplevel_window_event_handler.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/wm/resize_shadow_controller.h" | 8 #include "ash/wm/resize_shadow_controller.h" |
| 9 #include "ash/wm/window_resizer.h" | 9 #include "ash/wm/window_resizer.h" |
| 10 #include "ash/wm/window_state.h" | 10 #include "ash/wm/window_state.h" |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 in_gesture_drag_ = in_move_loop_ = false; | 369 in_gesture_drag_ = in_move_loop_ = false; |
| 370 return move_cancelled_ ? aura::client::MOVE_CANCELED : | 370 return move_cancelled_ ? aura::client::MOVE_CANCELED : |
| 371 aura::client::MOVE_SUCCESSFUL; | 371 aura::client::MOVE_SUCCESSFUL; |
| 372 } | 372 } |
| 373 | 373 |
| 374 void ToplevelWindowEventHandler::EndMoveLoop() { | 374 void ToplevelWindowEventHandler::EndMoveLoop() { |
| 375 if (!in_move_loop_) | 375 if (!in_move_loop_) |
| 376 return; | 376 return; |
| 377 | 377 |
| 378 in_move_loop_ = false; | 378 in_move_loop_ = false; |
| 379 if (window_resizer_) { | 379 CompleteDrag(DRAG_REVERT, 0); |
| 380 window_resizer_->resizer()->RevertDrag(); | |
| 381 window_resizer_.reset(); | |
| 382 } | |
| 383 quit_closure_.Run(); | 380 quit_closure_.Run(); |
| 384 } | 381 } |
| 385 | 382 |
| 386 void ToplevelWindowEventHandler::OnDisplayConfigurationChanging() { | 383 void ToplevelWindowEventHandler::OnDisplayConfigurationChanging() { |
| 387 if (in_move_loop_) { | 384 if (in_move_loop_) { |
| 388 move_cancelled_ = true; | 385 move_cancelled_ = true; |
| 389 EndMoveLoop(); | 386 EndMoveLoop(); |
| 390 } else if (window_resizer_) { | 387 } else { |
| 391 window_resizer_->resizer()->RevertDrag(); | 388 CompleteDrag(DRAG_REVERT, 0); |
| 392 window_resizer_.reset(); | |
| 393 } | 389 } |
| 394 } | 390 } |
| 395 | 391 |
| 396 void ToplevelWindowEventHandler::CreateScopedWindowResizer( | 392 void ToplevelWindowEventHandler::CreateScopedWindowResizer( |
| 397 aura::Window* window, | 393 aura::Window* window, |
| 398 const gfx::Point& point_in_parent, | 394 const gfx::Point& point_in_parent, |
| 399 int window_component, | 395 int window_component, |
| 400 aura::client::WindowMoveSource source) { | 396 aura::client::WindowMoveSource source) { |
| 401 window_resizer_.reset(); | 397 window_resizer_.reset(); |
| 402 WindowResizer* resizer = | 398 WindowResizer* resizer = |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 void ToplevelWindowEventHandler::ResizerWindowDestroyed() { | 525 void ToplevelWindowEventHandler::ResizerWindowDestroyed() { |
| 530 // We explicitly don't invoke RevertDrag() since that may do things to window. | 526 // We explicitly don't invoke RevertDrag() since that may do things to window. |
| 531 // Instead we destroy the resizer. | 527 // Instead we destroy the resizer. |
| 532 window_resizer_.reset(); | 528 window_resizer_.reset(); |
| 533 | 529 |
| 534 // End the move loop. This does nothing if we're not in a move loop. | 530 // End the move loop. This does nothing if we're not in a move loop. |
| 535 EndMoveLoop(); | 531 EndMoveLoop(); |
| 536 } | 532 } |
| 537 | 533 |
| 538 } // namespace ash | 534 } // namespace ash |
| OLD | NEW |