OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/root_window_controller.h" | 5 #include "ash/root_window_controller.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/desktop_background/desktop_background_widget_controller.h" | 9 #include "ash/desktop_background/desktop_background_widget_controller.h" |
10 #include "ash/display/display_controller.h" | 10 #include "ash/display/display_controller.h" |
11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
12 #include "ash/shell_factory.h" | 12 #include "ash/shell_factory.h" |
13 #include "ash/shell_window_ids.h" | 13 #include "ash/shell_window_ids.h" |
14 #include "ash/wm/base_layout_manager.h" | 14 #include "ash/wm/base_layout_manager.h" |
15 #include "ash/wm/event_client_impl.h" | 15 #include "ash/wm/event_client_impl.h" |
16 #include "ash/wm/property_util.h" | 16 #include "ash/wm/property_util.h" |
17 #include "ash/wm/root_window_layout_manager.h" | 17 #include "ash/wm/root_window_layout_manager.h" |
18 #include "ash/wm/screen_dimmer.h" | 18 #include "ash/wm/screen_dimmer.h" |
19 #include "ash/wm/system_modal_container_layout_manager.h" | 19 #include "ash/wm/system_modal_container_layout_manager.h" |
20 #include "ash/wm/toplevel_window_event_filter.h" | 20 #include "ash/wm/toplevel_window_event_handler.h" |
21 #include "ash/wm/visibility_controller.h" | 21 #include "ash/wm/visibility_controller.h" |
22 #include "ash/wm/window_properties.h" | 22 #include "ash/wm/window_properties.h" |
23 #include "ash/wm/workspace_controller.h" | 23 #include "ash/wm/workspace_controller.h" |
24 #include "ui/aura/client/activation_client.h" | 24 #include "ui/aura/client/activation_client.h" |
25 #include "ui/aura/client/aura_constants.h" | 25 #include "ui/aura/client/aura_constants.h" |
26 #include "ui/aura/client/capture_client.h" | 26 #include "ui/aura/client/capture_client.h" |
27 #include "ui/aura/client/tooltip_client.h" | 27 #include "ui/aura/client/tooltip_client.h" |
28 #include "ui/aura/focus_manager.h" | 28 #include "ui/aura/focus_manager.h" |
29 #include "ui/aura/root_window.h" | 29 #include "ui/aura/root_window.h" |
30 #include "ui/aura/window.h" | 30 #include "ui/aura/window.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 root_window); | 170 root_window); |
171 | 171 |
172 CreateContainer(internal::kShellWindowId_UnparentedControlContainer, | 172 CreateContainer(internal::kShellWindowId_UnparentedControlContainer, |
173 "UnparentedControlContainer", | 173 "UnparentedControlContainer", |
174 non_lock_screen_containers); | 174 non_lock_screen_containers); |
175 | 175 |
176 aura::Window* default_container = CreateContainer( | 176 aura::Window* default_container = CreateContainer( |
177 internal::kShellWindowId_DefaultContainer, | 177 internal::kShellWindowId_DefaultContainer, |
178 "DefaultContainer", | 178 "DefaultContainer", |
179 non_lock_screen_containers); | 179 non_lock_screen_containers); |
180 default_container->SetEventFilter( | 180 if (!internal::WorkspaceController::IsWorkspace2Enabled()) { |
181 new ToplevelWindowEventFilter(default_container)); | 181 default_container->AddPreTargetHandler( |
| 182 new ToplevelWindowEventHandler(default_container)); |
| 183 } |
182 SetChildWindowVisibilityChangesAnimated(default_container); | 184 SetChildWindowVisibilityChangesAnimated(default_container); |
183 SetUsesScreenCoordinates(default_container); | 185 SetUsesScreenCoordinates(default_container); |
184 | 186 |
185 aura::Window* always_on_top_container = CreateContainer( | 187 aura::Window* always_on_top_container = CreateContainer( |
186 internal::kShellWindowId_AlwaysOnTopContainer, | 188 internal::kShellWindowId_AlwaysOnTopContainer, |
187 "AlwaysOnTopContainer", | 189 "AlwaysOnTopContainer", |
188 non_lock_screen_containers); | 190 non_lock_screen_containers); |
189 always_on_top_container->SetEventFilter( | 191 always_on_top_container->AddPreTargetHandler( |
190 new ToplevelWindowEventFilter(always_on_top_container)); | 192 new ToplevelWindowEventHandler(always_on_top_container)); |
191 SetChildWindowVisibilityChangesAnimated(always_on_top_container); | 193 SetChildWindowVisibilityChangesAnimated(always_on_top_container); |
192 SetUsesScreenCoordinates(always_on_top_container); | 194 SetUsesScreenCoordinates(always_on_top_container); |
193 | 195 |
194 aura::Window* panel_container = CreateContainer( | 196 aura::Window* panel_container = CreateContainer( |
195 internal::kShellWindowId_PanelContainer, | 197 internal::kShellWindowId_PanelContainer, |
196 "PanelContainer", | 198 "PanelContainer", |
197 non_lock_screen_containers); | 199 non_lock_screen_containers); |
198 SetUsesScreenCoordinates(panel_container); | 200 SetUsesScreenCoordinates(panel_container); |
199 | 201 |
200 aura::Window* launcher_container = | 202 aura::Window* launcher_container = |
201 CreateContainer(internal::kShellWindowId_LauncherContainer, | 203 CreateContainer(internal::kShellWindowId_LauncherContainer, |
202 "LauncherContainer", | 204 "LauncherContainer", |
203 non_lock_screen_containers); | 205 non_lock_screen_containers); |
204 SetUsesScreenCoordinates(launcher_container); | 206 SetUsesScreenCoordinates(launcher_container); |
205 | 207 |
206 CreateContainer(internal::kShellWindowId_AppListContainer, | 208 CreateContainer(internal::kShellWindowId_AppListContainer, |
207 "AppListContainer", | 209 "AppListContainer", |
208 non_lock_screen_containers); | 210 non_lock_screen_containers); |
209 | 211 |
210 aura::Window* modal_container = CreateContainer( | 212 aura::Window* modal_container = CreateContainer( |
211 internal::kShellWindowId_SystemModalContainer, | 213 internal::kShellWindowId_SystemModalContainer, |
212 "SystemModalContainer", | 214 "SystemModalContainer", |
213 non_lock_screen_containers); | 215 non_lock_screen_containers); |
214 modal_container->SetEventFilter( | 216 modal_container->AddPreTargetHandler( |
215 new ToplevelWindowEventFilter(modal_container)); | 217 new ToplevelWindowEventHandler(modal_container)); |
216 modal_container->SetLayoutManager( | 218 modal_container->SetLayoutManager( |
217 new internal::SystemModalContainerLayoutManager(modal_container)); | 219 new internal::SystemModalContainerLayoutManager(modal_container)); |
218 SetChildWindowVisibilityChangesAnimated(modal_container); | 220 SetChildWindowVisibilityChangesAnimated(modal_container); |
219 SetUsesScreenCoordinates(modal_container); | 221 SetUsesScreenCoordinates(modal_container); |
220 | 222 |
221 aura::Window* input_method_container = CreateContainer( | 223 aura::Window* input_method_container = CreateContainer( |
222 internal::kShellWindowId_InputMethodContainer, | 224 internal::kShellWindowId_InputMethodContainer, |
223 "InputMethodContainer", | 225 "InputMethodContainer", |
224 non_lock_screen_containers); | 226 non_lock_screen_containers); |
225 SetUsesScreenCoordinates(input_method_container); | 227 SetUsesScreenCoordinates(input_method_container); |
226 | 228 |
227 // TODO(beng): Figure out if we can make this use | 229 // TODO(beng): Figure out if we can make this use |
228 // SystemModalContainerEventFilter instead of stops_event_propagation. | 230 // SystemModalContainerEventFilter instead of stops_event_propagation. |
229 aura::Window* lock_container = CreateContainer( | 231 aura::Window* lock_container = CreateContainer( |
230 internal::kShellWindowId_LockScreenContainer, | 232 internal::kShellWindowId_LockScreenContainer, |
231 "LockScreenContainer", | 233 "LockScreenContainer", |
232 lock_screen_containers); | 234 lock_screen_containers); |
233 lock_container->SetLayoutManager( | 235 lock_container->SetLayoutManager( |
234 new internal::BaseLayoutManager(root_window)); | 236 new internal::BaseLayoutManager(root_window)); |
235 SetUsesScreenCoordinates(lock_container); | 237 SetUsesScreenCoordinates(lock_container); |
236 // TODO(beng): stopsevents | 238 // TODO(beng): stopsevents |
237 | 239 |
238 aura::Window* lock_modal_container = CreateContainer( | 240 aura::Window* lock_modal_container = CreateContainer( |
239 internal::kShellWindowId_LockSystemModalContainer, | 241 internal::kShellWindowId_LockSystemModalContainer, |
240 "LockSystemModalContainer", | 242 "LockSystemModalContainer", |
241 lock_screen_containers); | 243 lock_screen_containers); |
242 lock_modal_container->SetEventFilter( | 244 lock_modal_container->AddPreTargetHandler( |
243 new ToplevelWindowEventFilter(lock_modal_container)); | 245 new ToplevelWindowEventHandler(lock_modal_container)); |
244 lock_modal_container->SetLayoutManager( | 246 lock_modal_container->SetLayoutManager( |
245 new internal::SystemModalContainerLayoutManager(lock_modal_container)); | 247 new internal::SystemModalContainerLayoutManager(lock_modal_container)); |
246 SetChildWindowVisibilityChangesAnimated(lock_modal_container); | 248 SetChildWindowVisibilityChangesAnimated(lock_modal_container); |
247 SetUsesScreenCoordinates(lock_modal_container); | 249 SetUsesScreenCoordinates(lock_modal_container); |
248 | 250 |
249 aura::Window* status_container = | 251 aura::Window* status_container = |
250 CreateContainer(internal::kShellWindowId_StatusContainer, | 252 CreateContainer(internal::kShellWindowId_StatusContainer, |
251 "StatusContainer", | 253 "StatusContainer", |
252 lock_screen_related_containers); | 254 lock_screen_related_containers); |
253 SetUsesScreenCoordinates(status_container); | 255 SetUsesScreenCoordinates(status_container); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 // Restore focused or active window if it's still alive. | 374 // Restore focused or active window if it's still alive. |
373 if (focused && tracker.Contains(focused) && dst->Contains(focused)) { | 375 if (focused && tracker.Contains(focused) && dst->Contains(focused)) { |
374 dst->GetFocusManager()->SetFocusedWindow(focused, NULL); | 376 dst->GetFocusManager()->SetFocusedWindow(focused, NULL); |
375 } else if (active && tracker.Contains(active) && dst->Contains(active)) { | 377 } else if (active && tracker.Contains(active) && dst->Contains(active)) { |
376 activation_client->ActivateWindow(active); | 378 activation_client->ActivateWindow(active); |
377 } | 379 } |
378 } | 380 } |
379 | 381 |
380 } // namespace internal | 382 } // namespace internal |
381 } // namespace ash | 383 } // namespace ash |
OLD | NEW |