OLD | NEW |
---|---|
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 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
415 | 415 |
416 // Don't adjust window bounds if the bounds are empty as this | 416 // Don't adjust window bounds if the bounds are empty as this |
417 // happens when a new views::Widget is created. | 417 // happens when a new views::Widget is created. |
418 if (bounds.IsEmpty()) | 418 if (bounds.IsEmpty()) |
419 return true; | 419 return true; |
420 | 420 |
421 // Only windows of type WINDOW_TYPE_NORMAL or WINDOW_TYPE_PANEL need to be | 421 // Only windows of type WINDOW_TYPE_NORMAL or WINDOW_TYPE_PANEL need to be |
422 // adjusted to have minimum visibility, because they are positioned by the | 422 // adjusted to have minimum visibility, because they are positioned by the |
423 // user and user should always be able to interact with them. Other | 423 // user and user should always be able to interact with them. Other |
424 // windows are positioned programmatically. | 424 // windows are positioned programmatically. |
425 if (window_state->window()->type() != ui::wm::WINDOW_TYPE_NORMAL && | 425 if (!wm::IsWindowUserPositionable(window_state->window())) |
oshima
2015/06/04 19:49:12
ditto
bruthig
2015/06/04 19:56:23
Done.
| |
426 window_state->window()->type() != ui::wm::WINDOW_TYPE_PANEL) { | |
427 return true; | 426 return true; |
428 } | |
429 | 427 |
430 // Use entire display instead of workarea because the workarea can | 428 // Use entire display instead of workarea because the workarea can |
431 // be further shrunk by the docked area. The logic ensures 30% | 429 // be further shrunk by the docked area. The logic ensures 30% |
432 // visibility which should be enough to see where the window gets | 430 // visibility which should be enough to see where the window gets |
433 // moved. | 431 // moved. |
434 gfx::Rect display_area = ScreenUtil::GetDisplayBoundsInParent(window); | 432 gfx::Rect display_area = ScreenUtil::GetDisplayBoundsInParent(window); |
435 int min_width = bounds.width() * kMinimumPercentOnScreenArea; | 433 int min_width = bounds.width() * kMinimumPercentOnScreenArea; |
436 int min_height = bounds.height() * kMinimumPercentOnScreenArea; | 434 int min_height = bounds.height() * kMinimumPercentOnScreenArea; |
437 AdjustBoundsToEnsureWindowVisibility( | 435 AdjustBoundsToEnsureWindowVisibility( |
438 display_area, min_width, min_height, &bounds); | 436 display_area, min_width, min_height, &bounds); |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
735 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window); | 733 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window); |
736 center_in_parent.ClampToCenteredSize(window->bounds().size()); | 734 center_in_parent.ClampToCenteredSize(window->bounds().size()); |
737 window_state->SetBoundsDirectAnimated(center_in_parent); | 735 window_state->SetBoundsDirectAnimated(center_in_parent); |
738 } | 736 } |
739 // Centering window is treated as if a user moved and resized the window. | 737 // Centering window is treated as if a user moved and resized the window. |
740 window_state->set_bounds_changed_by_user(true); | 738 window_state->set_bounds_changed_by_user(true); |
741 } | 739 } |
742 | 740 |
743 } // namespace wm | 741 } // namespace wm |
744 } // namespace ash | 742 } // namespace ash |
OLD | NEW |