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/system_pinch_handler.h" | 5 #include "ash/wm/gestures/system_pinch_handler.h" |
6 | 6 |
7 #include "ash/launcher/launcher.h" | 7 #include "ash/launcher/launcher.h" |
8 #include "ash/screen_ash.h" | 8 #include "ash/screen_ash.h" |
9 #include "ash/shelf/shelf_widget.h" | 9 #include "ash/shelf/shelf_widget.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 break; | 79 break; |
80 } | 80 } |
81 | 81 |
82 case ui::ET_GESTURE_MULTIFINGER_SWIPE: { | 82 case ui::ET_GESTURE_MULTIFINGER_SWIPE: { |
83 phantom_.Hide(); | 83 phantom_.Hide(); |
84 pinch_factor_ = 1.0; | 84 pinch_factor_ = 1.0; |
85 phantom_state_ = PHANTOM_WINDOW_NORMAL; | 85 phantom_state_ = PHANTOM_WINDOW_NORMAL; |
86 | 86 |
87 if (event.details().swipe_left() || event.details().swipe_right()) { | 87 if (event.details().swipe_left() || event.details().swipe_right()) { |
88 // Snap for left/right swipes. | 88 // Snap for left/right swipes. |
89 ui::ScopedLayerAnimationSettings settings( | 89 using internal::SnapSizer; |
90 target_->layer()->GetAnimator()); | 90 if (SnapSizer::CanSnapWindow(target_)) { |
91 internal::SnapSizer::SnapWindow(target_, | 91 ui::ScopedLayerAnimationSettings settings( |
92 event.details().swipe_left() ? internal::SnapSizer::LEFT_EDGE : | 92 target_->layer()->GetAnimator()); |
93 internal::SnapSizer::RIGHT_EDGE); | 93 SnapSizer::Edge edge = event.details().swipe_left() ? |
| 94 SnapSizer::LEFT_EDGE : SnapSizer::RIGHT_EDGE; |
| 95 SnapSizer::SnapWindow(target_, edge, SnapSizer::STEP_NO); |
| 96 } |
94 } else if (event.details().swipe_up()) { | 97 } else if (event.details().swipe_up()) { |
95 if (!wm::IsWindowMaximized(target_) && | 98 if (!wm::IsWindowMaximized(target_) && |
96 !wm::IsWindowFullscreen(target_)) | 99 !wm::IsWindowFullscreen(target_) && |
| 100 wm::CanMaximizeWindow(target_)) |
97 wm::MaximizeWindow(target_); | 101 wm::MaximizeWindow(target_); |
98 } else if (event.details().swipe_down()) { | 102 } else if (event.details().swipe_down()) { |
99 wm::MinimizeWindow(target_); | 103 wm::MinimizeWindow(target_); |
100 } else { | 104 } else { |
101 NOTREACHED() << "Swipe happened without a direction."; | 105 NOTREACHED() << "Swipe happened without a direction."; |
102 } | 106 } |
103 break; | 107 break; |
104 } | 108 } |
105 | 109 |
106 default: | 110 default: |
(...skipping 29 matching lines...) Expand all Loading... |
136 phantom_state_ = PHANTOM_WINDOW_MINIMIZED; | 140 phantom_state_ = PHANTOM_WINDOW_MINIMIZED; |
137 return rect; | 141 return rect; |
138 } | 142 } |
139 | 143 |
140 phantom_state_ = PHANTOM_WINDOW_NORMAL; | 144 phantom_state_ = PHANTOM_WINDOW_NORMAL; |
141 return window->bounds(); | 145 return window->bounds(); |
142 } | 146 } |
143 | 147 |
144 } // namespace internal | 148 } // namespace internal |
145 } // namespace ash | 149 } // namespace ash |
OLD | NEW |