| 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 13 matching lines...) Expand all Loading... |
| 24 namespace ash { | 24 namespace ash { |
| 25 namespace wm { | 25 namespace wm { |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 // This specifies how much percent (30%) of a window rect | 28 // This specifies how much percent (30%) of a window rect |
| 29 // must be visible when the window is added to the workspace. | 29 // must be visible when the window is added to the workspace. |
| 30 const float kMinimumPercentOnScreenArea = 0.3f; | 30 const float kMinimumPercentOnScreenArea = 0.3f; |
| 31 | 31 |
| 32 bool IsPanel(aura::Window* window) { | 32 bool IsPanel(aura::Window* window) { |
| 33 return window->parent() && | 33 return window->parent() && |
| 34 window->parent()->id() == internal::kShellWindowId_DockedContainer; | 34 window->parent()->id() == internal::kShellWindowId_PanelContainer; |
| 35 } | 35 } |
| 36 | 36 |
| 37 void MoveToDisplayForRestore(WindowState* window_state) { | 37 void MoveToDisplayForRestore(WindowState* window_state) { |
| 38 if (!window_state->HasRestoreBounds()) | 38 if (!window_state->HasRestoreBounds()) |
| 39 return; | 39 return; |
| 40 const gfx::Rect& restore_bounds = window_state->GetRestoreBoundsInScreen(); | 40 const gfx::Rect& restore_bounds = window_state->GetRestoreBoundsInScreen(); |
| 41 | 41 |
| 42 // Move only if the restore bounds is outside of | 42 // Move only if the restore bounds is outside of |
| 43 // the display. There is no information about in which | 43 // the display. There is no information about in which |
| 44 // display it should be restored, so this is best guess. | 44 // display it should be restored, so this is best guess. |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window); | 596 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window); |
| 597 center_in_parent.ClampToCenteredSize(window->bounds().size()); | 597 center_in_parent.ClampToCenteredSize(window->bounds().size()); |
| 598 window_state->SetBoundsDirectAnimated(center_in_parent); | 598 window_state->SetBoundsDirectAnimated(center_in_parent); |
| 599 } | 599 } |
| 600 // Centering window is treated as if a user moved and resized the window. | 600 // Centering window is treated as if a user moved and resized the window. |
| 601 window_state->set_bounds_changed_by_user(true); | 601 window_state->set_bounds_changed_by_user(true); |
| 602 } | 602 } |
| 603 | 603 |
| 604 } // namespace wm | 604 } // namespace wm |
| 605 } // namespace ash | 605 } // namespace ash |
| OLD | NEW |