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

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

Issue 1921883002: Removes WindowState::aura_window() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix windows build Created 4 years, 7 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
« no previous file with comments | « ash/wm/default_state.h ('k') | ash/wm/dock/docked_window_layout_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/shell_window_ids.h" 7 #include "ash/shell_window_ids.h"
8 #include "ash/wm/aura/wm_window_aura.h"
9 #include "ash/wm/common/window_animation_types.h" 8 #include "ash/wm/common/window_animation_types.h"
10 #include "ash/wm/common/window_parenting_utils.h" 9 #include "ash/wm/common/window_parenting_utils.h"
11 #include "ash/wm/common/window_positioning_utils.h" 10 #include "ash/wm/common/window_positioning_utils.h"
12 #include "ash/wm/common/window_state_util.h" 11 #include "ash/wm/common/window_state_util.h"
13 #include "ash/wm/common/wm_event.h" 12 #include "ash/wm/common/wm_event.h"
14 #include "ash/wm/common/wm_globals.h" 13 #include "ash/wm/common/wm_globals.h"
15 #include "ash/wm/common/wm_root_window_controller.h" 14 #include "ash/wm/common/wm_root_window_controller.h"
16 #include "ash/wm/common/wm_screen_util.h" 15 #include "ash/wm/common/wm_screen_util.h"
16 #include "ash/wm/common/wm_window.h"
17 #include "ash/wm/dock/docked_window_layout_manager.h" 17 #include "ash/wm/dock/docked_window_layout_manager.h"
18 #include "ash/wm/window_state.h" 18 #include "ash/wm/window_state.h"
19 #include "ash/wm/window_state_delegate.h" 19 #include "ash/wm/window_state_delegate.h"
20 #include "ui/aura/window.h"
21 #include "ui/gfx/display.h" 20 #include "ui/gfx/display.h"
22 #include "ui/gfx/geometry/rect.h"
23 #include "ui/gfx/screen.h" 21 #include "ui/gfx/screen.h"
24 22
25 namespace ash { 23 namespace ash {
26 namespace wm { 24 namespace wm {
27 namespace { 25 namespace {
28 26
29 // This specifies how much percent (30%) of a window rect 27 // This specifies how much percent (30%) of a window rect
30 // must be visible when the window is added to the workspace. 28 // must be visible when the window is added to the workspace.
31 const float kMinimumPercentOnScreenArea = 0.3f; 29 const float kMinimumPercentOnScreenArea = 0.3f;
32 30
33 // When a window that has restore bounds at least as large as a work area is 31 // When a window that has restore bounds at least as large as a work area is
34 // unmaximized, inset the bounds slightly so that they are not exactly the same. 32 // unmaximized, inset the bounds slightly so that they are not exactly the same.
35 // This makes it easier to resize the window. 33 // This makes it easier to resize the window.
36 const int kMaximizedWindowInset = 10; // DIPs. 34 const int kMaximizedWindowInset = 10; // DIPs.
37 35
38 bool IsMinimizedWindowState(const WindowStateType state_type) { 36 bool IsMinimizedWindowState(const WindowStateType state_type) {
39 return state_type == WINDOW_STATE_TYPE_MINIMIZED || 37 return state_type == WINDOW_STATE_TYPE_MINIMIZED ||
40 state_type == WINDOW_STATE_TYPE_DOCKED_MINIMIZED; 38 state_type == WINDOW_STATE_TYPE_DOCKED_MINIMIZED;
41 } 39 }
42 40
43 void MoveToDisplayForRestore(WindowState* window_state) { 41 void MoveToDisplayForRestore(WindowState* window_state) {
44 if (!window_state->HasRestoreBounds()) 42 if (!window_state->HasRestoreBounds())
45 return; 43 return;
46 const gfx::Rect& restore_bounds = window_state->GetRestoreBoundsInScreen(); 44 const gfx::Rect restore_bounds = window_state->GetRestoreBoundsInScreen();
47 45
48 // Move only if the restore bounds is outside of 46 // Move only if the restore bounds is outside of
49 // the display. There is no information about in which 47 // the display. There is no information about in which
50 // display it should be restored, so this is best guess. 48 // display it should be restored, so this is best guess.
51 // TODO(oshima): Restore information should contain the 49 // TODO(oshima): Restore information should contain the
52 // work area information like WindowResizer does for the 50 // work area information like WindowResizer does for the
53 // last window location. 51 // last window location.
54 gfx::Rect display_area = 52 gfx::Rect display_area =
55 window_state->window()->GetDisplayNearestWindow().bounds(); 53 window_state->window()->GetDisplayNearestWindow().bounds();
56 54
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 gfx::Rect center_in_parent = GetDisplayWorkAreaBoundsInParent(window); 726 gfx::Rect center_in_parent = GetDisplayWorkAreaBoundsInParent(window);
729 center_in_parent.ClampToCenteredSize(window->GetBounds().size()); 727 center_in_parent.ClampToCenteredSize(window->GetBounds().size());
730 window_state->SetBoundsDirectAnimated(center_in_parent); 728 window_state->SetBoundsDirectAnimated(center_in_parent);
731 } 729 }
732 // Centering window is treated as if a user moved and resized the window. 730 // Centering window is treated as if a user moved and resized the window.
733 window_state->set_bounds_changed_by_user(true); 731 window_state->set_bounds_changed_by_user(true);
734 } 732 }
735 733
736 } // namespace wm 734 } // namespace wm
737 } // namespace ash 735 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/default_state.h ('k') | ash/wm/dock/docked_window_layout_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698