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 16 matching lines...) Expand all Loading... |
27 namespace wm { | 27 namespace wm { |
28 namespace { | 28 namespace { |
29 | 29 |
30 // This specifies how much percent (30%) of a window rect | 30 // This specifies how much percent (30%) of a window rect |
31 // must be visible when the window is added to the workspace. | 31 // must be visible when the window is added to the workspace. |
32 const float kMinimumPercentOnScreenArea = 0.3f; | 32 const float kMinimumPercentOnScreenArea = 0.3f; |
33 | 33 |
34 // When a window that has restore bounds at least as large as a work area is | 34 // When a window that has restore bounds at least as large as a work area is |
35 // unmaximized, inset the bounds slightly so that they are not exactly the same. | 35 // unmaximized, inset the bounds slightly so that they are not exactly the same. |
36 // This makes it easier to resize the window. | 36 // This makes it easier to resize the window. |
37 const int kMaximizedWindowInset = 10; // Pixels. | 37 const int kMaximizedWindowInset = 10; // DIPs. |
38 | 38 |
39 bool IsMinimizedWindowState(const WindowStateType state_type) { | 39 bool IsMinimizedWindowState(const WindowStateType state_type) { |
40 return state_type == WINDOW_STATE_TYPE_MINIMIZED || | 40 return state_type == WINDOW_STATE_TYPE_MINIMIZED || |
41 state_type == WINDOW_STATE_TYPE_DOCKED_MINIMIZED; | 41 state_type == WINDOW_STATE_TYPE_DOCKED_MINIMIZED; |
42 } | 42 } |
43 | 43 |
44 void MoveToDisplayForRestore(WindowState* window_state) { | 44 void MoveToDisplayForRestore(WindowState* window_state) { |
45 if (!window_state->HasRestoreBounds()) | 45 if (!window_state->HasRestoreBounds()) |
46 return; | 46 return; |
47 const gfx::Rect& restore_bounds = window_state->GetRestoreBoundsInScreen(); | 47 const gfx::Rect& restore_bounds = window_state->GetRestoreBoundsInScreen(); |
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window); | 737 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window); |
738 center_in_parent.ClampToCenteredSize(window->bounds().size()); | 738 center_in_parent.ClampToCenteredSize(window->bounds().size()); |
739 window_state->SetBoundsDirectAnimated(center_in_parent); | 739 window_state->SetBoundsDirectAnimated(center_in_parent); |
740 } | 740 } |
741 // Centering window is treated as if a user moved and resized the window. | 741 // Centering window is treated as if a user moved and resized the window. |
742 window_state->set_bounds_changed_by_user(true); | 742 window_state->set_bounds_changed_by_user(true); |
743 } | 743 } |
744 | 744 |
745 } // namespace wm | 745 } // namespace wm |
746 } // namespace ash | 746 } // namespace ash |
OLD | NEW |