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

Side by Side Diff: ash/root_window_controller_common.cc

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

Powered by Google App Engine
This is Rietveld 408576698