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

Side by Side Diff: ash/wm/default_state.cc

Issue 424463002: Makes a window that has been resized to maximized bounds, then maximized and then restored shrink (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Maximizes a window that has been resized to maximized bounds (only update size when unmaximizing) Created 6 years, 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/default_state.h" 5 #include "ash/wm/default_state.h"
6 6
7 #include "ash/display/display_controller.h" 7 #include "ash/display/display_controller.h"
8 #include "ash/screen_util.h" 8 #include "ash/screen_util.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_window_ids.h" 10 #include "ash/shell_window_ids.h"
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 case WINDOW_STATE_TYPE_LEFT_SNAPPED: 504 case WINDOW_STATE_TYPE_LEFT_SNAPPED:
505 case WINDOW_STATE_TYPE_RIGHT_SNAPPED: 505 case WINDOW_STATE_TYPE_RIGHT_SNAPPED:
506 bounds_in_parent = state_type_ == WINDOW_STATE_TYPE_LEFT_SNAPPED ? 506 bounds_in_parent = state_type_ == WINDOW_STATE_TYPE_LEFT_SNAPPED ?
507 GetDefaultLeftSnappedWindowBoundsInParent(window_state->window()) : 507 GetDefaultLeftSnappedWindowBoundsInParent(window_state->window()) :
508 GetDefaultRightSnappedWindowBoundsInParent(window_state->window()); 508 GetDefaultRightSnappedWindowBoundsInParent(window_state->window());
509 break; 509 break;
510 case WINDOW_STATE_TYPE_DEFAULT: 510 case WINDOW_STATE_TYPE_DEFAULT:
511 case WINDOW_STATE_TYPE_NORMAL: { 511 case WINDOW_STATE_TYPE_NORMAL: {
512 gfx::Rect work_area_in_parent = 512 gfx::Rect work_area_in_parent =
513 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_state->window()); 513 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_state->window());
514 if (window_state->HasRestoreBounds()) 514 if (window_state->HasRestoreBounds()) {
515 bounds_in_parent = window_state->GetRestoreBoundsInParent(); 515 bounds_in_parent = window_state->GetRestoreBoundsInParent();
516 else 516 if (previous_state_type == WINDOW_STATE_TYPE_MAXIMIZED &&
517 bounds_in_parent == work_area_in_parent) {
518 // Inset the bounds slightly so that they are not exactly same as
519 // work area bounds and it is easier to resize the window.
520 bounds_in_parent.Inset(10, 10, 10, 10);
pkotwicz 2014/07/31 03:39:57 |bounds_in_parent| might be bigger than |work_area
varkha 2014/08/01 21:00:24 I think checking for a larger size should solve it
521 }
522 } else {
517 bounds_in_parent = window->bounds(); 523 bounds_in_parent = window->bounds();
524 }
518 // Make sure that part of the window is always visible. 525 // Make sure that part of the window is always visible.
519 AdjustBoundsToEnsureMinimumWindowVisibility( 526 AdjustBoundsToEnsureMinimumWindowVisibility(
520 work_area_in_parent, &bounds_in_parent); 527 work_area_in_parent, &bounds_in_parent);
521 break; 528 break;
522 } 529 }
523 case WINDOW_STATE_TYPE_MAXIMIZED: 530 case WINDOW_STATE_TYPE_MAXIMIZED:
524 bounds_in_parent = ScreenUtil::GetMaximizedWindowBoundsInParent(window); 531 bounds_in_parent = ScreenUtil::GetMaximizedWindowBoundsInParent(window);
525 break; 532 break;
526 533
527 case WINDOW_STATE_TYPE_FULLSCREEN: 534 case WINDOW_STATE_TYPE_FULLSCREEN:
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window); 604 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window);
598 center_in_parent.ClampToCenteredSize(window->bounds().size()); 605 center_in_parent.ClampToCenteredSize(window->bounds().size());
599 window_state->SetBoundsDirectAnimated(center_in_parent); 606 window_state->SetBoundsDirectAnimated(center_in_parent);
600 } 607 }
601 // Centering window is treated as if a user moved and resized the window. 608 // Centering window is treated as if a user moved and resized the window.
602 window_state->set_bounds_changed_by_user(true); 609 window_state->set_bounds_changed_by_user(true);
603 } 610 }
604 611
605 } // namespace wm 612 } // namespace wm
606 } // namespace ash 613 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/wm/window_state_unittest.cc » ('j') | chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698