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

Side by Side Diff: ash/wm/toplevel_window_event_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/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"
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 // Minimize/maximize. 294 // Minimize/maximize.
295 if (event->details().velocity_y() > 0 && 295 if (event->details().velocity_y() > 0 &&
296 wm::CanMinimizeWindow(target)) { 296 wm::CanMinimizeWindow(target)) {
297 wm::MinimizeWindow(target); 297 wm::MinimizeWindow(target);
298 SetWindowAlwaysRestoresToRestoreBounds(target, true); 298 SetWindowAlwaysRestoresToRestoreBounds(target, true);
299 SetRestoreBoundsInParent(target, pre_drag_window_bounds_); 299 SetRestoreBoundsInParent(target, pre_drag_window_bounds_);
300 } else if (wm::CanMaximizeWindow(target)) { 300 } else if (wm::CanMaximizeWindow(target)) {
301 SetRestoreBoundsInParent(target, pre_drag_window_bounds_); 301 SetRestoreBoundsInParent(target, pre_drag_window_bounds_);
302 wm::MaximizeWindow(target); 302 wm::MaximizeWindow(target);
303 } 303 }
304 } else if (wm::CanSnapWindow(target) && 304 } else if (internal::SnapSizer::CanSnapWindow(target) &&
305 fabs(event->details().velocity_x()) > 305 fabs(event->details().velocity_x()) >
306 kMinHorizVelocityForWindowSwipe) { 306 kMinHorizVelocityForWindowSwipe) {
307 // Snap left/right. 307 // Snap left/right.
308 ui::ScopedLayerAnimationSettings scoped_setter( 308 ui::ScopedLayerAnimationSettings scoped_setter(
309 target->layer()->GetAnimator()); 309 target->layer()->GetAnimator());
310 scoped_setter.SetPreemptionStrategy( 310 scoped_setter.SetPreemptionStrategy(
311 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); 311 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS);
312 internal::SnapSizer::SnapWindow(target, 312 using internal::SnapSizer;
313 event->details().velocity_x() < 0 ? 313 SnapSizer::Edge edge = event->details().velocity_x() < 0 ?
314 internal::SnapSizer::LEFT_EDGE : internal::SnapSizer::RIGHT_EDGE); 314 SnapSizer::LEFT_EDGE : SnapSizer::RIGHT_EDGE;
315 SnapSizer::SnapWindow(target, edge, SnapSizer::STEP_NO);
315 } 316 }
316 break; 317 break;
317 } 318 }
318 default: 319 default:
319 return; 320 return;
320 } 321 }
321 322
322 event->StopPropagation(); 323 event->StopPropagation();
323 } 324 }
324 325
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 void ToplevelWindowEventHandler::ResizerWindowDestroyed() { 526 void ToplevelWindowEventHandler::ResizerWindowDestroyed() {
526 // We explicitly don't invoke RevertDrag() since that may do things to window. 527 // We explicitly don't invoke RevertDrag() since that may do things to window.
527 // Instead we destroy the resizer. 528 // Instead we destroy the resizer.
528 window_resizer_.reset(); 529 window_resizer_.reset();
529 530
530 // End the move loop. This does nothing if we're not in a move loop. 531 // End the move loop. This does nothing if we're not in a move loop.
531 EndMoveLoop(); 532 EndMoveLoop();
532 } 533 }
533 534
534 } // namespace ash 535 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698