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" |
11 #include "ash/wm/window_resizer.h" | 11 #include "ash/wm/window_resizer.h" |
12 #include "ash/wm/window_util.h" | 12 #include "ash/wm/window_util.h" |
13 #include "ash/wm/workspace/snap_sizer.h" | |
14 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
15 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
16 #include "ui/aura/client/aura_constants.h" | 15 #include "ui/aura/client/aura_constants.h" |
17 #include "ui/aura/client/cursor_client.h" | 16 #include "ui/aura/client/cursor_client.h" |
18 #include "ui/aura/env.h" | 17 #include "ui/aura/env.h" |
19 #include "ui/aura/root_window.h" | 18 #include "ui/aura/root_window.h" |
20 #include "ui/aura/window.h" | 19 #include "ui/aura/window.h" |
21 #include "ui/aura/window_delegate.h" | 20 #include "ui/aura/window_delegate.h" |
22 #include "ui/aura/window_observer.h" | 21 #include "ui/aura/window_observer.h" |
23 #include "ui/base/cursor/cursor.h" | 22 #include "ui/base/cursor/cursor.h" |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 wm::MaximizeWindow(target); | 301 wm::MaximizeWindow(target); |
303 } | 302 } |
304 } else if (wm::CanSnapWindow(target) && | 303 } else if (wm::CanSnapWindow(target) && |
305 fabs(event->details().velocity_x()) > | 304 fabs(event->details().velocity_x()) > |
306 kMinHorizVelocityForWindowSwipe) { | 305 kMinHorizVelocityForWindowSwipe) { |
307 // Snap left/right. | 306 // Snap left/right. |
308 ui::ScopedLayerAnimationSettings scoped_setter( | 307 ui::ScopedLayerAnimationSettings scoped_setter( |
309 target->layer()->GetAnimator()); | 308 target->layer()->GetAnimator()); |
310 scoped_setter.SetPreemptionStrategy( | 309 scoped_setter.SetPreemptionStrategy( |
311 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); | 310 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); |
312 internal::SnapSizer::SnapWindow(target, | 311 wm::SnapWindowToEdge(target, |
313 event->details().velocity_x() < 0 ? | 312 event->details().velocity_x() < 0 ? |
314 internal::SnapSizer::LEFT_EDGE : internal::SnapSizer::RIGHT_EDGE); | 313 wm::SNAP_LEFT_EDGE : wm::SNAP_RIGHT_EDGE); |
315 } | 314 } |
316 break; | 315 break; |
317 } | 316 } |
318 default: | 317 default: |
319 return; | 318 return; |
320 } | 319 } |
321 | 320 |
322 event->StopPropagation(); | 321 event->StopPropagation(); |
323 } | 322 } |
324 | 323 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 void ToplevelWindowEventHandler::ResizerWindowDestroyed() { | 524 void ToplevelWindowEventHandler::ResizerWindowDestroyed() { |
526 // We explicitly don't invoke RevertDrag() since that may do things to window. | 525 // We explicitly don't invoke RevertDrag() since that may do things to window. |
527 // Instead we destroy the resizer. | 526 // Instead we destroy the resizer. |
528 window_resizer_.reset(); | 527 window_resizer_.reset(); |
529 | 528 |
530 // End the move loop. This does nothing if we're not in a move loop. | 529 // End the move loop. This does nothing if we're not in a move loop. |
531 EndMoveLoop(); | 530 EndMoveLoop(); |
532 } | 531 } |
533 | 532 |
534 } // namespace ash | 533 } // namespace ash |
OLD | NEW |