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

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

Issue 2808723004: Renames WmShell to ShellPort (Closed)
Patch Set: feedback Created 3 years, 8 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
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/public/cpp/shell_window_ids.h" 7 #include "ash/public/cpp/shell_window_ids.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_port.h"
10 #include "ash/wm/screen_pinning_controller.h" 11 #include "ash/wm/screen_pinning_controller.h"
11 #include "ash/wm/window_animation_types.h" 12 #include "ash/wm/window_animation_types.h"
12 #include "ash/wm/window_parenting_utils.h" 13 #include "ash/wm/window_parenting_utils.h"
13 #include "ash/wm/window_positioning_utils.h" 14 #include "ash/wm/window_positioning_utils.h"
14 #include "ash/wm/window_state.h" 15 #include "ash/wm/window_state.h"
15 #include "ash/wm/window_state_delegate.h" 16 #include "ash/wm/window_state_delegate.h"
16 #include "ash/wm/window_state_util.h" 17 #include "ash/wm/window_state_util.h"
17 #include "ash/wm/wm_event.h" 18 #include "ash/wm/wm_event.h"
18 #include "ash/wm/wm_screen_util.h" 19 #include "ash/wm/wm_screen_util.h"
19 #include "ash/wm_shell.h"
20 #include "ash/wm_window.h" 20 #include "ash/wm_window.h"
21 #include "ui/display/display.h" 21 #include "ui/display/display.h"
22 #include "ui/display/screen.h" 22 #include "ui/display/screen.h"
23 23
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.
(...skipping 18 matching lines...) Expand all
48 // display it should be restored, so this is best guess. 48 // display it should be restored, so this is best guess.
49 // TODO(oshima): Restore information should contain the 49 // TODO(oshima): Restore information should contain the
50 // work area information like WindowResizer does for the 50 // work area information like WindowResizer does for the
51 // last window location. 51 // last window location.
52 gfx::Rect display_area = 52 gfx::Rect display_area =
53 window_state->window()->GetDisplayNearestWindow().bounds(); 53 window_state->window()->GetDisplayNearestWindow().bounds();
54 54
55 if (!display_area.Intersects(restore_bounds)) { 55 if (!display_area.Intersects(restore_bounds)) {
56 const display::Display& display = 56 const display::Display& display =
57 display::Screen::GetScreen()->GetDisplayMatching(restore_bounds); 57 display::Screen::GetScreen()->GetDisplayMatching(restore_bounds);
58 WmShell* shell = window_state->window()->GetShell(); 58 WmWindow* new_root =
59 WmWindow* new_root = shell->GetRootWindowForDisplayId(display.id()); 59 ShellPort::Get()->GetRootWindowForDisplayId(display.id());
60 if (new_root != window_state->window()->GetRootWindow()) { 60 if (new_root != window_state->window()->GetRootWindow()) {
61 WmWindow* new_container = new_root->GetChildByShellWindowId( 61 WmWindow* new_container = new_root->GetChildByShellWindowId(
62 window_state->window()->GetParent()->GetShellWindowId()); 62 window_state->window()->GetParent()->GetShellWindowId());
63 new_container->AddChild(window_state->window()); 63 new_container->AddChild(window_state->window());
64 } 64 }
65 } 65 }
66 } 66 }
67 67
68 void CycleSnap(WindowState* window_state, WMEventType event) { 68 void CycleSnap(WindowState* window_state, WMEventType event) {
69 wm::WindowStateType desired_snap_state = 69 wm::WindowStateType desired_snap_state =
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 gfx::Rect center_in_parent = GetDisplayWorkAreaBoundsInParent(window); 688 gfx::Rect center_in_parent = GetDisplayWorkAreaBoundsInParent(window);
689 center_in_parent.ClampToCenteredSize(window->GetBounds().size()); 689 center_in_parent.ClampToCenteredSize(window->GetBounds().size());
690 window_state->SetBoundsDirectAnimated(center_in_parent); 690 window_state->SetBoundsDirectAnimated(center_in_parent);
691 } 691 }
692 // Centering window is treated as if a user moved and resized the window. 692 // Centering window is treated as if a user moved and resized the window.
693 window_state->set_bounds_changed_by_user(true); 693 window_state->set_bounds_changed_by_user(true);
694 } 694 }
695 695
696 } // namespace wm 696 } // namespace wm
697 } // namespace ash 697 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698