| 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/property_util.h" | 8 #include "ash/wm/property_util.h" |
| 9 #include "ash/wm/resize_shadow_controller.h" | 9 #include "ash/wm/resize_shadow_controller.h" |
| 10 #include "ash/wm/window_properties.h" | 10 #include "ash/wm/window_properties.h" |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 // Minimize/maximize. | 294 // Minimize/maximize. |
| 295 if (event->details().velocity_y() > 0 && | 295 if (event->details().velocity_y() > 0 && |
| 296 wm::CanMinimizeWindow(target)) { | 296 wm::CanMinimizeWindow(target)) { |
| 297 wm::MinimizeWindow(target); | 297 wm::MinimizeWindow(target); |
| 298 SetWindowAlwaysRestoresToRestoreBounds(target, true); | 298 SetWindowAlwaysRestoresToRestoreBounds(target, true); |
| 299 SetRestoreBoundsInParent(target, pre_drag_window_bounds_); | 299 SetRestoreBoundsInParent(target, pre_drag_window_bounds_); |
| 300 } else if (wm::CanMaximizeWindow(target)) { | 300 } else if (wm::CanMaximizeWindow(target)) { |
| 301 SetRestoreBoundsInParent(target, pre_drag_window_bounds_); | 301 SetRestoreBoundsInParent(target, pre_drag_window_bounds_); |
| 302 wm::MaximizeWindow(target); | 302 wm::MaximizeWindow(target); |
| 303 } | 303 } |
| 304 } else if (wm::CanSnapWindow(target) && | 304 } else if (internal::SnapSizer::CanSnapWindow(target) && |
| 305 fabs(event->details().velocity_x()) > | 305 fabs(event->details().velocity_x()) > |
| 306 kMinHorizVelocityForWindowSwipe) { | 306 kMinHorizVelocityForWindowSwipe) { |
| 307 // Snap left/right. | 307 // Snap left/right. |
| 308 ui::ScopedLayerAnimationSettings scoped_setter( | 308 ui::ScopedLayerAnimationSettings scoped_setter( |
| 309 target->layer()->GetAnimator()); | 309 target->layer()->GetAnimator()); |
| 310 scoped_setter.SetPreemptionStrategy( | 310 scoped_setter.SetPreemptionStrategy( |
| 311 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); | 311 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); |
| 312 internal::SnapSizer::SnapWindow(target, | 312 using internal::SnapSizer; |
| 313 event->details().velocity_x() < 0 ? | 313 SnapSizer::Edge edge = event->details().velocity_x() < 0 ? |
| 314 internal::SnapSizer::LEFT_EDGE : internal::SnapSizer::RIGHT_EDGE); | 314 SnapSizer::LEFT_EDGE : SnapSizer::RIGHT_EDGE; |
| 315 SnapSizer::SnapWindow(target, edge, SnapSizer::STEP_NO); |
| 315 } | 316 } |
| 316 break; | 317 break; |
| 317 } | 318 } |
| 318 default: | 319 default: |
| 319 return; | 320 return; |
| 320 } | 321 } |
| 321 | 322 |
| 322 event->StopPropagation(); | 323 event->StopPropagation(); |
| 323 } | 324 } |
| 324 | 325 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 void ToplevelWindowEventHandler::ResizerWindowDestroyed() { | 526 void ToplevelWindowEventHandler::ResizerWindowDestroyed() { |
| 526 // We explicitly don't invoke RevertDrag() since that may do things to window. | 527 // We explicitly don't invoke RevertDrag() since that may do things to window. |
| 527 // Instead we destroy the resizer. | 528 // Instead we destroy the resizer. |
| 528 window_resizer_.reset(); | 529 window_resizer_.reset(); |
| 529 | 530 |
| 530 // End the move loop. This does nothing if we're not in a move loop. | 531 // End the move loop. This does nothing if we're not in a move loop. |
| 531 EndMoveLoop(); | 532 EndMoveLoop(); |
| 532 } | 533 } |
| 533 | 534 |
| 534 } // namespace ash | 535 } // namespace ash |
| OLD | NEW |