Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(309)

Side by Side Diff: ash/wm/gestures/two_finger_drag_handler.cc

Issue 23471004: Only support left/right maximizing at 50% width when the --ash-enable-alternate-caption-button (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaned up unittests + varkha@'s suggestions Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 // For a swipe, the window either maximizes, minimizes, or snaps. In this 135 // For a swipe, the window either maximizes, minimizes, or snaps. In this
136 // case, cancel the drag, and do the appropriate action. 136 // case, cancel the drag, and do the appropriate action.
137 Reset(); 137 Reset();
138 138
139 if (event.details().swipe_up()) { 139 if (event.details().swipe_up()) {
140 if (wm::CanMaximizeWindow(target)) 140 if (wm::CanMaximizeWindow(target))
141 wm::MaximizeWindow(target); 141 wm::MaximizeWindow(target);
142 } else if (event.details().swipe_down() && 142 } else if (event.details().swipe_down() &&
143 wm::CanMinimizeWindow(target)) { 143 wm::CanMinimizeWindow(target)) {
144 wm::MinimizeWindow(target); 144 wm::MinimizeWindow(target);
145 } else if (wm::CanSnapWindow(target)) { 145 } else if (internal::SnapSizer::CanSnapWindow(target)) {
146 ui::ScopedLayerAnimationSettings scoped_setter( 146 ui::ScopedLayerAnimationSettings scoped_setter(
147 target->layer()->GetAnimator()); 147 target->layer()->GetAnimator());
148 scoped_setter.SetPreemptionStrategy( 148 scoped_setter.SetPreemptionStrategy(
149 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); 149 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS);
150 internal::SnapSizer::SnapWindow(target, 150 using internal::SnapSizer;
151 event.details().swipe_left() ? internal::SnapSizer::LEFT_EDGE : 151 SnapSizer::Edge edge = event.details().swipe_left() ?
152 internal::SnapSizer::RIGHT_EDGE); 152 SnapSizer::LEFT_EDGE : SnapSizer::RIGHT_EDGE;
153 SnapSizer::SnapWindow(target, edge, SnapSizer::STEP_NO);
153 } 154 }
154 return true; 155 return true;
155 } 156 }
156 157
157 case ui::ET_GESTURE_PINCH_UPDATE: 158 case ui::ET_GESTURE_PINCH_UPDATE:
158 case ui::ET_GESTURE_SCROLL_UPDATE: 159 case ui::ET_GESTURE_SCROLL_UPDATE:
159 window_resizer_->Drag(event.details().bounding_box().CenterPoint(), 160 window_resizer_->Drag(event.details().bounding_box().CenterPoint(),
160 event.flags()); 161 event.flags());
161 return true; 162 return true;
162 163
(...skipping 26 matching lines...) Expand all
189 bool visible) { 190 bool visible) {
190 Reset(); 191 Reset();
191 } 192 }
192 193
193 void TwoFingerDragHandler::OnWindowDestroying(aura::Window* window) { 194 void TwoFingerDragHandler::OnWindowDestroying(aura::Window* window) {
194 Reset(); 195 Reset();
195 } 196 }
196 197
197 } // namespace internal 198 } // namespace internal
198 } // namespace ash 199 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698