| 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/gestures/two_finger_drag_handler.h" | 5 #include "ash/wm/gestures/two_finger_drag_handler.h" |
| 6 | 6 |
| 7 #include "ash/wm/window_resizer.h" | 7 #include "ash/wm/window_resizer.h" |
| 8 #include "ash/wm/window_util.h" | 8 #include "ash/wm/window_util.h" |
| 9 #include "ash/wm/workspace/snap_sizer.h" | 9 #include "ash/wm/workspace/snap_sizer.h" |
| 10 #include "ui/aura/client/window_types.h" | 10 #include "ui/aura/client/window_types.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 // For a swipe, the window either maximizes, minimizes, or snaps. In this | 126 // For a swipe, the window either maximizes, minimizes, or snaps. In this |
| 127 // case, cancel the drag, and do the appropriate action. | 127 // case, cancel the drag, and do the appropriate action. |
| 128 aura::Window* target = window_resizer_->GetTarget(); | 128 aura::Window* target = window_resizer_->GetTarget(); |
| 129 Reset(); | 129 Reset(); |
| 130 | 130 |
| 131 if (event.details().swipe_up()) { | 131 if (event.details().swipe_up()) { |
| 132 wm::MaximizeWindow(target); | 132 wm::MaximizeWindow(target); |
| 133 } else if (event.details().swipe_down()) { | 133 } else if (event.details().swipe_down()) { |
| 134 wm::MinimizeWindow(target); | 134 wm::MinimizeWindow(target); |
| 135 } else { | 135 } else { |
| 136 internal::SnapSizer sizer(target, | |
| 137 gfx::Point(), | |
| 138 event.details().swipe_left() ? internal::SnapSizer::LEFT_EDGE : | |
| 139 internal::SnapSizer::RIGHT_EDGE, | |
| 140 internal::SnapSizer::OTHER_INPUT); | |
| 141 | |
| 142 ui::ScopedLayerAnimationSettings scoped_setter( | 136 ui::ScopedLayerAnimationSettings scoped_setter( |
| 143 target->layer()->GetAnimator()); | 137 target->layer()->GetAnimator()); |
| 144 scoped_setter.SetPreemptionStrategy( | 138 scoped_setter.SetPreemptionStrategy( |
| 145 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); | 139 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); |
| 146 target->SetBounds(sizer.target_bounds()); | 140 wm::SnapWindow(target, |
| 141 event.details().swipe_left() ? internal::SnapSizer::LEFT_EDGE : |
| 142 internal::SnapSizer::RIGHT_EDGE); |
| 147 } | 143 } |
| 148 return true; | 144 return true; |
| 149 } | 145 } |
| 150 | 146 |
| 151 case ui::ET_GESTURE_PINCH_UPDATE: | 147 case ui::ET_GESTURE_PINCH_UPDATE: |
| 152 case ui::ET_GESTURE_SCROLL_UPDATE: | 148 case ui::ET_GESTURE_SCROLL_UPDATE: |
| 153 window_resizer_->Drag(event.details().bounding_box().CenterPoint(), | 149 window_resizer_->Drag(event.details().bounding_box().CenterPoint(), |
| 154 event.flags()); | 150 event.flags()); |
| 155 return true; | 151 return true; |
| 156 | 152 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 183 bool visible) { | 179 bool visible) { |
| 184 Reset(); | 180 Reset(); |
| 185 } | 181 } |
| 186 | 182 |
| 187 void TwoFingerDragHandler::OnWindowDestroying(aura::Window* window) { | 183 void TwoFingerDragHandler::OnWindowDestroying(aura::Window* window) { |
| 188 Reset(); | 184 Reset(); |
| 189 } | 185 } |
| 190 | 186 |
| 191 } // namespace internal | 187 } // namespace internal |
| 192 } // namespace ash | 188 } // namespace ash |
| OLD | NEW |