Chromium Code Reviews| 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 337 kMinHorizVelocityForWindowSwipe) { | 337 kMinHorizVelocityForWindowSwipe) { |
| 338 SetWindowStateTypeFromGesture(target, | 338 SetWindowStateTypeFromGesture(target, |
| 339 wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED); | 339 wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED); |
| 340 } else if (event->details().velocity_x() < | 340 } else if (event->details().velocity_x() < |
| 341 -kMinHorizVelocityForWindowSwipe) { | 341 -kMinHorizVelocityForWindowSwipe) { |
| 342 SetWindowStateTypeFromGesture(target, | 342 SetWindowStateTypeFromGesture(target, |
| 343 wm::WINDOW_STATE_TYPE_LEFT_SNAPPED); | 343 wm::WINDOW_STATE_TYPE_LEFT_SNAPPED); |
| 344 } | 344 } |
| 345 event->StopPropagation(); | 345 event->StopPropagation(); |
| 346 return; | 346 return; |
| 347 case ui::ET_GESTURE_MULTIFINGER_SWIPE: | 347 case ui::ET_GESTURE_SWIPE: |
| 348 if (event->details().touch_points() <= 1) | |
|
tdresser
2014/05/26 20:49:58
I'd split out the invalid case here.
DCHECK(event
mfomitchev
2014/05/26 22:07:14
Done.
| |
| 349 return; | |
| 348 if (!wm::GetWindowState(target)->IsNormalOrSnapped()) | 350 if (!wm::GetWindowState(target)->IsNormalOrSnapped()) |
| 349 return; | 351 return; |
| 350 | 352 |
| 351 CompleteDrag(DRAG_COMPLETE); | 353 CompleteDrag(DRAG_COMPLETE); |
| 352 | 354 |
| 353 if (event->details().swipe_down()) { | 355 if (event->details().swipe_down()) { |
| 354 SetWindowStateTypeFromGesture(target, wm::WINDOW_STATE_TYPE_MINIMIZED); | 356 SetWindowStateTypeFromGesture(target, wm::WINDOW_STATE_TYPE_MINIMIZED); |
| 355 } else if (event->details().swipe_up()) { | 357 } else if (event->details().swipe_up()) { |
| 356 SetWindowStateTypeFromGesture(target, wm::WINDOW_STATE_TYPE_MAXIMIZED); | 358 SetWindowStateTypeFromGesture(target, wm::WINDOW_STATE_TYPE_MAXIMIZED); |
| 357 } else if (event->details().swipe_right()) { | 359 } else if (event->details().swipe_right()) { |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 606 | 608 |
| 607 void ToplevelWindowEventHandler::ResizerWindowDestroyed() { | 609 void ToplevelWindowEventHandler::ResizerWindowDestroyed() { |
| 608 // We explicitly don't invoke RevertDrag() since that may do things to window. | 610 // We explicitly don't invoke RevertDrag() since that may do things to window. |
| 609 // Instead we destroy the resizer. | 611 // Instead we destroy the resizer. |
| 610 window_resizer_.reset(); | 612 window_resizer_.reset(); |
| 611 | 613 |
| 612 CompleteDrag(DRAG_REVERT); | 614 CompleteDrag(DRAG_REVERT); |
| 613 } | 615 } |
| 614 | 616 |
| 615 } // namespace ash | 617 } // namespace ash |
| OLD | NEW |