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

Side by Side Diff: ash/common/root_window_controller_common.cc

Issue 2035543004: Shuffles and renames ash/common/wm classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: random changes for chrome tests Created 4 years, 6 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/common/root_window_controller_common.h" 5 #include "ash/common/root_window_controller_common.h"
6 6
7 #include "ash/common/shell_window_ids.h" 7 #include "ash/common/shell_window_ids.h"
8 #include "ash/common/wm/root_window_layout_manager.h" 8 #include "ash/common/wm/root_window_layout_manager.h"
9 #include "ash/common/wm/wm_globals.h" 9 #include "ash/common/wm_shell.h"
10 #include "ash/common/wm/wm_window.h" 10 #include "ash/common/wm_window.h"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 12
13 namespace ash { 13 namespace ash {
14 namespace { 14 namespace {
15 15
16 // Creates a new window for use as a container. 16 // Creates a new window for use as a container.
17 wm::WmWindow* CreateContainer(int window_id, 17 WmWindow* CreateContainer(int window_id, const char* name, WmWindow* parent) {
18 const char* name, 18 WmWindow* window = WmShell::Get()->NewContainerWindow();
19 wm::WmWindow* parent) {
20 wm::WmWindow* window = wm::WmGlobals::Get()->NewContainerWindow();
21 window->SetShellWindowId(window_id); 19 window->SetShellWindowId(window_id);
22 window->SetName(name); 20 window->SetName(name);
23 parent->AddChild(window); 21 parent->AddChild(window);
24 if (window_id != kShellWindowId_UnparentedControlContainer) 22 if (window_id != kShellWindowId_UnparentedControlContainer)
25 window->Show(); 23 window->Show();
26 return window; 24 return window;
27 } 25 }
28 26
29 } // namespace 27 } // namespace
30 28
31 RootWindowControllerCommon::RootWindowControllerCommon(wm::WmWindow* root) 29 RootWindowControllerCommon::RootWindowControllerCommon(WmWindow* root)
32 : root_(root), root_window_layout_(nullptr) {} 30 : root_(root), root_window_layout_(nullptr) {}
33 31
34 RootWindowControllerCommon::~RootWindowControllerCommon() {} 32 RootWindowControllerCommon::~RootWindowControllerCommon() {}
35 33
36 void RootWindowControllerCommon::CreateContainers() { 34 void RootWindowControllerCommon::CreateContainers() {
37 // These containers are just used by PowerButtonController to animate groups 35 // These containers are just used by PowerButtonController to animate groups
38 // of containers simultaneously without messing up the current transformations 36 // of containers simultaneously without messing up the current transformations
39 // on those containers. These are direct children of the root window; all of 37 // on those containers. These are direct children of the root window; all of
40 // the other containers are their children. 38 // the other containers are their children.
41 39
42 // The desktop background container is not part of the lock animation, so it 40 // The desktop background container is not part of the lock animation, so it
43 // is not included in those animate groups. 41 // is not included in those animate groups.
44 // When screen is locked desktop background is moved to lock screen background 42 // When screen is locked desktop background is moved to lock screen background
45 // container (moved back on unlock). We want to make sure that there's an 43 // container (moved back on unlock). We want to make sure that there's an
46 // opaque layer occluding the non-lock-screen layers. 44 // opaque layer occluding the non-lock-screen layers.
47 wm::WmWindow* desktop_background_container = 45 WmWindow* desktop_background_container =
48 CreateContainer(kShellWindowId_DesktopBackgroundContainer, 46 CreateContainer(kShellWindowId_DesktopBackgroundContainer,
49 "DesktopBackgroundContainer", root_); 47 "DesktopBackgroundContainer", root_);
50 desktop_background_container->SetChildWindowVisibilityChangesAnimated(); 48 desktop_background_container->SetChildWindowVisibilityChangesAnimated();
51 49
52 wm::WmWindow* non_lock_screen_containers = 50 WmWindow* non_lock_screen_containers =
53 CreateContainer(kShellWindowId_NonLockScreenContainersContainer, 51 CreateContainer(kShellWindowId_NonLockScreenContainersContainer,
54 "NonLockScreenContainersContainer", root_); 52 "NonLockScreenContainersContainer", root_);
55 // Clip all windows inside this container, as half pixel of the window's 53 // Clip all windows inside this container, as half pixel of the window's
56 // texture may become visible when the screen is scaled. crbug.com/368591. 54 // texture may become visible when the screen is scaled. crbug.com/368591.
57 non_lock_screen_containers->SetMasksToBounds(true); 55 non_lock_screen_containers->SetMasksToBounds(true);
58 56
59 wm::WmWindow* lock_background_containers = 57 WmWindow* lock_background_containers =
60 CreateContainer(kShellWindowId_LockScreenBackgroundContainer, 58 CreateContainer(kShellWindowId_LockScreenBackgroundContainer,
61 "LockScreenBackgroundContainer", root_); 59 "LockScreenBackgroundContainer", root_);
62 lock_background_containers->SetChildWindowVisibilityChangesAnimated(); 60 lock_background_containers->SetChildWindowVisibilityChangesAnimated();
63 61
64 wm::WmWindow* lock_screen_containers = 62 WmWindow* lock_screen_containers =
65 CreateContainer(kShellWindowId_LockScreenContainersContainer, 63 CreateContainer(kShellWindowId_LockScreenContainersContainer,
66 "LockScreenContainersContainer", root_); 64 "LockScreenContainersContainer", root_);
67 wm::WmWindow* lock_screen_related_containers = 65 WmWindow* lock_screen_related_containers =
68 CreateContainer(kShellWindowId_LockScreenRelatedContainersContainer, 66 CreateContainer(kShellWindowId_LockScreenRelatedContainersContainer,
69 "LockScreenRelatedContainersContainer", root_); 67 "LockScreenRelatedContainersContainer", root_);
70 68
71 CreateContainer(kShellWindowId_UnparentedControlContainer, 69 CreateContainer(kShellWindowId_UnparentedControlContainer,
72 "UnparentedControlContainer", non_lock_screen_containers); 70 "UnparentedControlContainer", non_lock_screen_containers);
73 71
74 wm::WmWindow* default_container = 72 WmWindow* default_container =
75 CreateContainer(kShellWindowId_DefaultContainer, "DefaultContainer", 73 CreateContainer(kShellWindowId_DefaultContainer, "DefaultContainer",
76 non_lock_screen_containers); 74 non_lock_screen_containers);
77 default_container->SetChildWindowVisibilityChangesAnimated(); 75 default_container->SetChildWindowVisibilityChangesAnimated();
78 default_container->SetSnapsChildrenToPhysicalPixelBoundary(); 76 default_container->SetSnapsChildrenToPhysicalPixelBoundary();
79 default_container->SetBoundsInScreenBehaviorForChildren( 77 default_container->SetBoundsInScreenBehaviorForChildren(
80 wm::WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES); 78 WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
81 default_container->SetChildrenUseExtendedHitRegion(); 79 default_container->SetChildrenUseExtendedHitRegion();
82 80
83 wm::WmWindow* always_on_top_container = 81 WmWindow* always_on_top_container =
84 CreateContainer(kShellWindowId_AlwaysOnTopContainer, 82 CreateContainer(kShellWindowId_AlwaysOnTopContainer,
85 "AlwaysOnTopContainer", non_lock_screen_containers); 83 "AlwaysOnTopContainer", non_lock_screen_containers);
86 always_on_top_container->SetChildWindowVisibilityChangesAnimated(); 84 always_on_top_container->SetChildWindowVisibilityChangesAnimated();
87 always_on_top_container->SetSnapsChildrenToPhysicalPixelBoundary(); 85 always_on_top_container->SetSnapsChildrenToPhysicalPixelBoundary();
88 always_on_top_container->SetBoundsInScreenBehaviorForChildren( 86 always_on_top_container->SetBoundsInScreenBehaviorForChildren(
89 wm::WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES); 87 WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
90 88
91 wm::WmWindow* docked_container = 89 WmWindow* docked_container =
92 CreateContainer(kShellWindowId_DockedContainer, "DockedContainer", 90 CreateContainer(kShellWindowId_DockedContainer, "DockedContainer",
93 non_lock_screen_containers); 91 non_lock_screen_containers);
94 docked_container->SetChildWindowVisibilityChangesAnimated(); 92 docked_container->SetChildWindowVisibilityChangesAnimated();
95 docked_container->SetSnapsChildrenToPhysicalPixelBoundary(); 93 docked_container->SetSnapsChildrenToPhysicalPixelBoundary();
96 docked_container->SetBoundsInScreenBehaviorForChildren( 94 docked_container->SetBoundsInScreenBehaviorForChildren(
97 wm::WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES); 95 WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
98 docked_container->SetChildrenUseExtendedHitRegion(); 96 docked_container->SetChildrenUseExtendedHitRegion();
99 97
100 wm::WmWindow* shelf_container = 98 WmWindow* shelf_container =
101 CreateContainer(kShellWindowId_ShelfContainer, "ShelfContainer", 99 CreateContainer(kShellWindowId_ShelfContainer, "ShelfContainer",
102 non_lock_screen_containers); 100 non_lock_screen_containers);
103 shelf_container->SetSnapsChildrenToPhysicalPixelBoundary(); 101 shelf_container->SetSnapsChildrenToPhysicalPixelBoundary();
104 shelf_container->SetBoundsInScreenBehaviorForChildren( 102 shelf_container->SetBoundsInScreenBehaviorForChildren(
105 wm::WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES); 103 WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
106 shelf_container->SetDescendantsStayInSameRootWindow(true); 104 shelf_container->SetDescendantsStayInSameRootWindow(true);
107 105
108 wm::WmWindow* panel_container = 106 WmWindow* panel_container =
109 CreateContainer(kShellWindowId_PanelContainer, "PanelContainer", 107 CreateContainer(kShellWindowId_PanelContainer, "PanelContainer",
110 non_lock_screen_containers); 108 non_lock_screen_containers);
111 panel_container->SetSnapsChildrenToPhysicalPixelBoundary(); 109 panel_container->SetSnapsChildrenToPhysicalPixelBoundary();
112 panel_container->SetBoundsInScreenBehaviorForChildren( 110 panel_container->SetBoundsInScreenBehaviorForChildren(
113 wm::WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES); 111 WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
114 112
115 wm::WmWindow* shelf_bubble_container = 113 WmWindow* shelf_bubble_container =
116 CreateContainer(kShellWindowId_ShelfBubbleContainer, 114 CreateContainer(kShellWindowId_ShelfBubbleContainer,
117 "ShelfBubbleContainer", non_lock_screen_containers); 115 "ShelfBubbleContainer", non_lock_screen_containers);
118 shelf_bubble_container->SetSnapsChildrenToPhysicalPixelBoundary(); 116 shelf_bubble_container->SetSnapsChildrenToPhysicalPixelBoundary();
119 shelf_bubble_container->SetBoundsInScreenBehaviorForChildren( 117 shelf_bubble_container->SetBoundsInScreenBehaviorForChildren(
120 wm::WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES); 118 WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
121 shelf_bubble_container->SetDescendantsStayInSameRootWindow(true); 119 shelf_bubble_container->SetDescendantsStayInSameRootWindow(true);
122 120
123 wm::WmWindow* app_list_container = 121 WmWindow* app_list_container =
124 CreateContainer(kShellWindowId_AppListContainer, "AppListContainer", 122 CreateContainer(kShellWindowId_AppListContainer, "AppListContainer",
125 non_lock_screen_containers); 123 non_lock_screen_containers);
126 app_list_container->SetSnapsChildrenToPhysicalPixelBoundary(); 124 app_list_container->SetSnapsChildrenToPhysicalPixelBoundary();
127 app_list_container->SetBoundsInScreenBehaviorForChildren( 125 app_list_container->SetBoundsInScreenBehaviorForChildren(
128 wm::WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES); 126 WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
129 127
130 wm::WmWindow* modal_container = 128 WmWindow* modal_container =
131 CreateContainer(kShellWindowId_SystemModalContainer, 129 CreateContainer(kShellWindowId_SystemModalContainer,
132 "SystemModalContainer", non_lock_screen_containers); 130 "SystemModalContainer", non_lock_screen_containers);
133 modal_container->SetSnapsChildrenToPhysicalPixelBoundary(); 131 modal_container->SetSnapsChildrenToPhysicalPixelBoundary();
134 modal_container->SetChildWindowVisibilityChangesAnimated(); 132 modal_container->SetChildWindowVisibilityChangesAnimated();
135 modal_container->SetBoundsInScreenBehaviorForChildren( 133 modal_container->SetBoundsInScreenBehaviorForChildren(
136 wm::WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES); 134 WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
137 modal_container->SetChildrenUseExtendedHitRegion(); 135 modal_container->SetChildrenUseExtendedHitRegion();
138 136
139 // TODO(beng): Figure out if we can make this use 137 // TODO(beng): Figure out if we can make this use
140 // SystemModalContainerEventFilter instead of stops_event_propagation. 138 // SystemModalContainerEventFilter instead of stops_event_propagation.
141 wm::WmWindow* lock_container = 139 WmWindow* lock_container =
142 CreateContainer(kShellWindowId_LockScreenContainer, "LockScreenContainer", 140 CreateContainer(kShellWindowId_LockScreenContainer, "LockScreenContainer",
143 lock_screen_containers); 141 lock_screen_containers);
144 lock_container->SetSnapsChildrenToPhysicalPixelBoundary(); 142 lock_container->SetSnapsChildrenToPhysicalPixelBoundary();
145 lock_container->SetBoundsInScreenBehaviorForChildren( 143 lock_container->SetBoundsInScreenBehaviorForChildren(
146 wm::WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES); 144 WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
147 // TODO(beng): stopsevents 145 // TODO(beng): stopsevents
148 146
149 wm::WmWindow* lock_modal_container = 147 WmWindow* lock_modal_container =
150 CreateContainer(kShellWindowId_LockSystemModalContainer, 148 CreateContainer(kShellWindowId_LockSystemModalContainer,
151 "LockSystemModalContainer", lock_screen_containers); 149 "LockSystemModalContainer", lock_screen_containers);
152 lock_modal_container->SetSnapsChildrenToPhysicalPixelBoundary(); 150 lock_modal_container->SetSnapsChildrenToPhysicalPixelBoundary();
153 lock_modal_container->SetChildWindowVisibilityChangesAnimated(); 151 lock_modal_container->SetChildWindowVisibilityChangesAnimated();
154 lock_modal_container->SetBoundsInScreenBehaviorForChildren( 152 lock_modal_container->SetBoundsInScreenBehaviorForChildren(
155 wm::WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES); 153 WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
156 lock_modal_container->SetChildrenUseExtendedHitRegion(); 154 lock_modal_container->SetChildrenUseExtendedHitRegion();
157 155
158 wm::WmWindow* status_container = 156 WmWindow* status_container =
159 CreateContainer(kShellWindowId_StatusContainer, "StatusContainer", 157 CreateContainer(kShellWindowId_StatusContainer, "StatusContainer",
160 lock_screen_related_containers); 158 lock_screen_related_containers);
161 status_container->SetSnapsChildrenToPhysicalPixelBoundary(); 159 status_container->SetSnapsChildrenToPhysicalPixelBoundary();
162 status_container->SetBoundsInScreenBehaviorForChildren( 160 status_container->SetBoundsInScreenBehaviorForChildren(
163 wm::WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES); 161 WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
164 status_container->SetDescendantsStayInSameRootWindow(true); 162 status_container->SetDescendantsStayInSameRootWindow(true);
165 163
166 wm::WmWindow* settings_bubble_container = 164 WmWindow* settings_bubble_container =
167 CreateContainer(kShellWindowId_SettingBubbleContainer, 165 CreateContainer(kShellWindowId_SettingBubbleContainer,
168 "SettingBubbleContainer", lock_screen_related_containers); 166 "SettingBubbleContainer", lock_screen_related_containers);
169 settings_bubble_container->SetChildWindowVisibilityChangesAnimated(); 167 settings_bubble_container->SetChildWindowVisibilityChangesAnimated();
170 settings_bubble_container->SetSnapsChildrenToPhysicalPixelBoundary(); 168 settings_bubble_container->SetSnapsChildrenToPhysicalPixelBoundary();
171 settings_bubble_container->SetBoundsInScreenBehaviorForChildren( 169 settings_bubble_container->SetBoundsInScreenBehaviorForChildren(
172 wm::WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES); 170 WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
173 settings_bubble_container->SetDescendantsStayInSameRootWindow(true); 171 settings_bubble_container->SetDescendantsStayInSameRootWindow(true);
174 172
175 wm::WmWindow* virtual_keyboard_parent_container = CreateContainer( 173 WmWindow* virtual_keyboard_parent_container = CreateContainer(
176 kShellWindowId_ImeWindowParentContainer, "VirtualKeyboardParentContainer", 174 kShellWindowId_ImeWindowParentContainer, "VirtualKeyboardParentContainer",
177 lock_screen_related_containers); 175 lock_screen_related_containers);
178 virtual_keyboard_parent_container->SetSnapsChildrenToPhysicalPixelBoundary(); 176 virtual_keyboard_parent_container->SetSnapsChildrenToPhysicalPixelBoundary();
179 virtual_keyboard_parent_container->SetBoundsInScreenBehaviorForChildren( 177 virtual_keyboard_parent_container->SetBoundsInScreenBehaviorForChildren(
180 wm::WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES); 178 WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
181 179
182 wm::WmWindow* menu_container = 180 WmWindow* menu_container =
183 CreateContainer(kShellWindowId_MenuContainer, "MenuContainer", 181 CreateContainer(kShellWindowId_MenuContainer, "MenuContainer",
184 lock_screen_related_containers); 182 lock_screen_related_containers);
185 menu_container->SetChildWindowVisibilityChangesAnimated(); 183 menu_container->SetChildWindowVisibilityChangesAnimated();
186 menu_container->SetSnapsChildrenToPhysicalPixelBoundary(); 184 menu_container->SetSnapsChildrenToPhysicalPixelBoundary();
187 menu_container->SetBoundsInScreenBehaviorForChildren( 185 menu_container->SetBoundsInScreenBehaviorForChildren(
188 wm::WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES); 186 WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
189 187
190 wm::WmWindow* drag_drop_container = CreateContainer( 188 WmWindow* drag_drop_container = CreateContainer(
191 kShellWindowId_DragImageAndTooltipContainer, 189 kShellWindowId_DragImageAndTooltipContainer,
192 "DragImageAndTooltipContainer", lock_screen_related_containers); 190 "DragImageAndTooltipContainer", lock_screen_related_containers);
193 drag_drop_container->SetChildWindowVisibilityChangesAnimated(); 191 drag_drop_container->SetChildWindowVisibilityChangesAnimated();
194 drag_drop_container->SetSnapsChildrenToPhysicalPixelBoundary(); 192 drag_drop_container->SetSnapsChildrenToPhysicalPixelBoundary();
195 drag_drop_container->SetBoundsInScreenBehaviorForChildren( 193 drag_drop_container->SetBoundsInScreenBehaviorForChildren(
196 wm::WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES); 194 WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
197 195
198 wm::WmWindow* overlay_container = 196 WmWindow* overlay_container =
199 CreateContainer(kShellWindowId_OverlayContainer, "OverlayContainer", 197 CreateContainer(kShellWindowId_OverlayContainer, "OverlayContainer",
200 lock_screen_related_containers); 198 lock_screen_related_containers);
201 overlay_container->SetSnapsChildrenToPhysicalPixelBoundary(); 199 overlay_container->SetSnapsChildrenToPhysicalPixelBoundary();
202 overlay_container->SetBoundsInScreenBehaviorForChildren( 200 overlay_container->SetBoundsInScreenBehaviorForChildren(
203 wm::WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES); 201 WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
204 202
205 #if defined(OS_CHROMEOS) 203 #if defined(OS_CHROMEOS)
206 wm::WmWindow* mouse_cursor_container = CreateContainer( 204 WmWindow* mouse_cursor_container = CreateContainer(
207 kShellWindowId_MouseCursorContainer, "MouseCursorContainer", root_); 205 kShellWindowId_MouseCursorContainer, "MouseCursorContainer", root_);
208 mouse_cursor_container->SetBoundsInScreenBehaviorForChildren( 206 mouse_cursor_container->SetBoundsInScreenBehaviorForChildren(
209 wm::WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES); 207 WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
210 #endif 208 #endif
211 209
212 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, 210 CreateContainer(kShellWindowId_PowerButtonAnimationContainer,
213 "PowerButtonAnimationContainer", root_); 211 "PowerButtonAnimationContainer", root_);
214 } 212 }
215 213
216 void RootWindowControllerCommon::CreateLayoutManagers() { 214 void RootWindowControllerCommon::CreateLayoutManagers() {
217 root_window_layout_ = new wm::RootWindowLayoutManager(root_); 215 root_window_layout_ = new wm::RootWindowLayoutManager(root_);
218 root_->SetLayoutManager(base::WrapUnique(root_window_layout_)); 216 root_->SetLayoutManager(base::WrapUnique(root_window_layout_));
219 } 217 }
220 218
221 } // namespace ash 219 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698