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 { |
varkha
2013/08/30 17:13:25
Did you leave out the x-velocity check intentional
pkotwicz
2013/08/30 21:10:57
Good catch!
| |
305 fabs(event->details().velocity_x()) > | 305 using internal::SnapSizer; |
306 kMinHorizVelocityForWindowSwipe) { | 306 SnapSizer::Edge edge = event->details().swipe_left() ? |
307 // Snap left/right. | 307 SnapSizer::LEFT_EDGE : SnapSizer::RIGHT_EDGE; |
308 ui::ScopedLayerAnimationSettings scoped_setter( | 308 if (SnapSizer::CanSnapWindow(target, edge)) { |
309 target->layer()->GetAnimator()); | 309 ui::ScopedLayerAnimationSettings scoped_setter( |
310 scoped_setter.SetPreemptionStrategy( | 310 target->layer()->GetAnimator()); |
311 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); | 311 scoped_setter.SetPreemptionStrategy( |
312 internal::SnapSizer::SnapWindow(target, | 312 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); |
313 event->details().velocity_x() < 0 ? | 313 SnapSizer::SnapWindow(target, edge, SnapSizer::STEP_NO); |
314 internal::SnapSizer::LEFT_EDGE : internal::SnapSizer::RIGHT_EDGE); | 314 } |
315 } | 315 } |
316 break; | 316 break; |
317 } | 317 } |
318 default: | 318 default: |
319 return; | 319 return; |
320 } | 320 } |
321 | 321 |
322 event->StopPropagation(); | 322 event->StopPropagation(); |
323 } | 323 } |
324 | 324 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
525 void ToplevelWindowEventHandler::ResizerWindowDestroyed() { | 525 void ToplevelWindowEventHandler::ResizerWindowDestroyed() { |
526 // 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. |
527 // Instead we destroy the resizer. | 527 // Instead we destroy the resizer. |
528 window_resizer_.reset(); | 528 window_resizer_.reset(); |
529 | 529 |
530 // 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. |
531 EndMoveLoop(); | 531 EndMoveLoop(); |
532 } | 532 } |
533 | 533 |
534 } // namespace ash | 534 } // namespace ash |
OLD | NEW |