| 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/ash_constants.h" | 9 #include "ash/ash_constants.h" |
| 10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| 11 #include "ash/desktop_background/desktop_background_widget_controller.h" | 11 #include "ash/desktop_background/desktop_background_widget_controller.h" |
| 12 #include "ash/display/display_controller.h" | 12 #include "ash/display/display_controller.h" |
| 13 #include "ash/display/display_manager.h" | 13 #include "ash/display/display_manager.h" |
| 14 #include "ash/focus_cycler.h" | 14 #include "ash/focus_cycler.h" |
| 15 #include "ash/session_state_delegate.h" | 15 #include "ash/session_state_delegate.h" |
| 16 #include "ash/shelf/shelf_layout_manager.h" | 16 #include "ash/shelf/shelf_layout_manager.h" |
| 17 #include "ash/shelf/shelf_types.h" | 17 #include "ash/shelf/shelf_types.h" |
| 18 #include "ash/shelf/shelf_widget.h" | 18 #include "ash/shelf/shelf_widget.h" |
| 19 #include "ash/shell.h" | 19 #include "ash/shell.h" |
| 20 #include "ash/shell_delegate.h" | 20 #include "ash/shell_delegate.h" |
| 21 #include "ash/shell_factory.h" | 21 #include "ash/shell_factory.h" |
| 22 #include "ash/shell_window_ids.h" | 22 #include "ash/shell_window_ids.h" |
| 23 #include "ash/system/status_area_widget.h" | 23 #include "ash/system/status_area_widget.h" |
| 24 #include "ash/system/tray/system_tray_delegate.h" | 24 #include "ash/system/tray/system_tray_delegate.h" |
| 25 #include "ash/touch/touch_observer_hud.h" | 25 #include "ash/touch/touch_observer_hud.h" |
| 26 #include "ash/wm/base_layout_manager.h" | 26 #include "ash/wm/base_layout_manager.h" |
| 27 #include "ash/wm/boot_splash_screen.h" | 27 #include "ash/wm/boot_splash_screen.h" |
| 28 #include "ash/wm/dock/docked_window_layout_manager.h" |
| 28 #include "ash/wm/panels/panel_layout_manager.h" | 29 #include "ash/wm/panels/panel_layout_manager.h" |
| 29 #include "ash/wm/property_util.h" | 30 #include "ash/wm/property_util.h" |
| 30 #include "ash/wm/root_window_layout_manager.h" | 31 #include "ash/wm/root_window_layout_manager.h" |
| 31 #include "ash/wm/screen_dimmer.h" | 32 #include "ash/wm/screen_dimmer.h" |
| 32 #include "ash/wm/stacking_controller.h" | 33 #include "ash/wm/stacking_controller.h" |
| 33 #include "ash/wm/status_area_layout_manager.h" | 34 #include "ash/wm/status_area_layout_manager.h" |
| 34 #include "ash/wm/system_background_controller.h" | 35 #include "ash/wm/system_background_controller.h" |
| 35 #include "ash/wm/system_modal_container_layout_manager.h" | 36 #include "ash/wm/system_modal_container_layout_manager.h" |
| 36 #include "ash/wm/toplevel_window_event_handler.h" | 37 #include "ash/wm/toplevel_window_event_handler.h" |
| 37 #include "ash/wm/window_properties.h" | 38 #include "ash/wm/window_properties.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 new_parent->AddChild(window); | 105 new_parent->AddChild(window); |
| 105 if (!restore_bounds.IsEmpty()) | 106 if (!restore_bounds.IsEmpty()) |
| 106 SetRestoreBoundsInParent(window, restore_bounds); | 107 SetRestoreBoundsInParent(window, restore_bounds); |
| 107 } | 108 } |
| 108 | 109 |
| 109 // Reparents the appropriate set of windows from |src| to |dst|. | 110 // Reparents the appropriate set of windows from |src| to |dst|. |
| 110 void ReparentAllWindows(aura::RootWindow* src, aura::RootWindow* dst) { | 111 void ReparentAllWindows(aura::RootWindow* src, aura::RootWindow* dst) { |
| 111 // Set of windows to move. | 112 // Set of windows to move. |
| 112 const int kContainerIdsToMove[] = { | 113 const int kContainerIdsToMove[] = { |
| 113 internal::kShellWindowId_DefaultContainer, | 114 internal::kShellWindowId_DefaultContainer, |
| 115 internal::kShellWindowId_DockedContainer, |
| 114 internal::kShellWindowId_PanelContainer, | 116 internal::kShellWindowId_PanelContainer, |
| 115 internal::kShellWindowId_AlwaysOnTopContainer, | 117 internal::kShellWindowId_AlwaysOnTopContainer, |
| 116 internal::kShellWindowId_SystemModalContainer, | 118 internal::kShellWindowId_SystemModalContainer, |
| 117 internal::kShellWindowId_LockSystemModalContainer, | 119 internal::kShellWindowId_LockSystemModalContainer, |
| 118 internal::kShellWindowId_InputMethodContainer, | 120 internal::kShellWindowId_InputMethodContainer, |
| 119 internal::kShellWindowId_UnparentedControlContainer, | 121 internal::kShellWindowId_UnparentedControlContainer, |
| 120 }; | 122 }; |
| 121 // For workspace windows we need to manually reparent the windows. This way | 123 // For workspace windows we need to manually reparent the windows. This way |
| 122 // workspace can move the windows to the appropriate workspace. | 124 // workspace can move the windows to the appropriate workspace. |
| 123 std::vector<aura::Window*> windows(GetWorkspaceWindows(src)); | 125 std::vector<aura::Window*> windows(GetWorkspaceWindows(src)); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 container->SetProperty(internal::kUsesScreenCoordinatesKey, true); | 161 container->SetProperty(internal::kUsesScreenCoordinatesKey, true); |
| 160 } | 162 } |
| 161 | 163 |
| 162 } // namespace | 164 } // namespace |
| 163 | 165 |
| 164 namespace internal { | 166 namespace internal { |
| 165 | 167 |
| 166 RootWindowController::RootWindowController(aura::RootWindow* root_window) | 168 RootWindowController::RootWindowController(aura::RootWindow* root_window) |
| 167 : root_window_(root_window), | 169 : root_window_(root_window), |
| 168 root_window_layout_(NULL), | 170 root_window_layout_(NULL), |
| 171 docked_layout_manager_(NULL), |
| 169 panel_layout_manager_(NULL), | 172 panel_layout_manager_(NULL), |
| 170 touch_observer_hud_(NULL) { | 173 touch_observer_hud_(NULL) { |
| 171 SetRootWindowController(root_window, this); | 174 SetRootWindowController(root_window, this); |
| 172 screen_dimmer_.reset(new ScreenDimmer(root_window)); | 175 screen_dimmer_.reset(new ScreenDimmer(root_window)); |
| 173 | 176 |
| 174 stacking_controller_.reset(new ash::StackingController); | 177 stacking_controller_.reset(new ash::StackingController); |
| 175 aura::client::SetStackingClient(root_window, stacking_controller_.get()); | 178 aura::client::SetStackingClient(root_window, stacking_controller_.get()); |
| 176 } | 179 } |
| 177 | 180 |
| 178 RootWindowController::~RootWindowController() { | 181 RootWindowController::~RootWindowController() { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 void RootWindowController::InitForPrimaryDisplay() { | 267 void RootWindowController::InitForPrimaryDisplay() { |
| 265 DCHECK(!shelf_.get()); | 268 DCHECK(!shelf_.get()); |
| 266 aura::Window* shelf_container = | 269 aura::Window* shelf_container = |
| 267 GetContainer(ash::internal::kShellWindowId_ShelfContainer); | 270 GetContainer(ash::internal::kShellWindowId_ShelfContainer); |
| 268 // TODO(harrym): Remove when status area is view. | 271 // TODO(harrym): Remove when status area is view. |
| 269 aura::Window* status_container = | 272 aura::Window* status_container = |
| 270 GetContainer(ash::internal::kShellWindowId_StatusContainer); | 273 GetContainer(ash::internal::kShellWindowId_StatusContainer); |
| 271 shelf_.reset(new ash::ShelfWidget( | 274 shelf_.reset(new ash::ShelfWidget( |
| 272 shelf_container, status_container, workspace_controller())); | 275 shelf_container, status_container, workspace_controller())); |
| 273 | 276 |
| 277 // Create Docked windows layout manager |
| 278 aura::Window* docked_container = GetContainer( |
| 279 internal::kShellWindowId_DockedContainer); |
| 280 docked_layout_manager_ = |
| 281 new internal::DockedWindowLayoutManager(docked_container); |
| 282 docked_container_handler_.reset( |
| 283 new ToplevelWindowEventHandler(docked_container)); |
| 284 docked_container->SetLayoutManager(docked_layout_manager_); |
| 285 |
| 274 // Create Panel layout manager | 286 // Create Panel layout manager |
| 275 aura::Window* panel_container = GetContainer( | 287 aura::Window* panel_container = GetContainer( |
| 276 internal::kShellWindowId_PanelContainer); | 288 internal::kShellWindowId_PanelContainer); |
| 277 panel_layout_manager_ = | 289 panel_layout_manager_ = |
| 278 new internal::PanelLayoutManager(panel_container); | 290 new internal::PanelLayoutManager(panel_container); |
| 279 panel_container_handler_.reset( | 291 panel_container_handler_.reset( |
| 280 new ToplevelWindowEventHandler(panel_container)); | 292 new ToplevelWindowEventHandler(panel_container)); |
| 281 panel_container->SetLayoutManager(panel_layout_manager_); | 293 panel_container->SetLayoutManager(panel_layout_manager_); |
| 282 | 294 |
| 283 // TODO(stevenjb/oshima): Remove this call to CreateLauncher() and call | 295 // TODO(stevenjb/oshima): Remove this call to CreateLauncher() and call |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 switches::kAshCopyHostBackgroundAtBoot) || | 330 switches::kAshCopyHostBackgroundAtBoot) || |
| 319 CommandLine::ForCurrentProcess()->HasSwitch( | 331 CommandLine::ForCurrentProcess()->HasSwitch( |
| 320 switches::kAshAnimateFromBootSplashScreen))) | 332 switches::kAshAnimateFromBootSplashScreen))) |
| 321 boot_splash_screen_.reset(new BootSplashScreen(root_window_.get())); | 333 boot_splash_screen_.reset(new BootSplashScreen(root_window_.get())); |
| 322 #endif | 334 #endif |
| 323 } | 335 } |
| 324 | 336 |
| 325 void RootWindowController::OnLauncherCreated() { | 337 void RootWindowController::OnLauncherCreated() { |
| 326 if (panel_layout_manager_) | 338 if (panel_layout_manager_) |
| 327 panel_layout_manager_->SetLauncher(shelf_->launcher()); | 339 panel_layout_manager_->SetLauncher(shelf_->launcher()); |
| 340 if (docked_layout_manager_) |
| 341 docked_layout_manager_->SetLauncher(shelf_->launcher()); |
| 328 } | 342 } |
| 329 | 343 |
| 330 void RootWindowController::ShowLauncher() { | 344 void RootWindowController::ShowLauncher() { |
| 331 if (!shelf_.get() || !shelf_->launcher()) | 345 if (!shelf_.get() || !shelf_->launcher()) |
| 332 return; | 346 return; |
| 333 shelf_->launcher()->SetVisible(true); | 347 shelf_->launcher()->SetVisible(true); |
| 334 shelf_->status_area_widget()->Show(); | 348 shelf_->status_area_widget()->Show(); |
| 335 } | 349 } |
| 336 | 350 |
| 337 void RootWindowController::OnLoginStateChanged(user::LoginStatus status) { | 351 void RootWindowController::OnLoginStateChanged(user::LoginStatus status) { |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 aura::Window* always_on_top_container = CreateContainer( | 543 aura::Window* always_on_top_container = CreateContainer( |
| 530 kShellWindowId_AlwaysOnTopContainer, | 544 kShellWindowId_AlwaysOnTopContainer, |
| 531 "AlwaysOnTopContainer", | 545 "AlwaysOnTopContainer", |
| 532 non_lock_screen_containers); | 546 non_lock_screen_containers); |
| 533 always_on_top_container_handler_.reset( | 547 always_on_top_container_handler_.reset( |
| 534 new ToplevelWindowEventHandler(always_on_top_container)); | 548 new ToplevelWindowEventHandler(always_on_top_container)); |
| 535 views::corewm::SetChildWindowVisibilityChangesAnimated( | 549 views::corewm::SetChildWindowVisibilityChangesAnimated( |
| 536 always_on_top_container); | 550 always_on_top_container); |
| 537 SetUsesScreenCoordinates(always_on_top_container); | 551 SetUsesScreenCoordinates(always_on_top_container); |
| 538 | 552 |
| 553 aura::Window* docked_container = CreateContainer( |
| 554 kShellWindowId_DockedContainer, |
| 555 "DockedContainer", |
| 556 non_lock_screen_containers); |
| 557 SetUsesScreenCoordinates(docked_container); |
| 558 |
| 539 aura::Window* panel_container = CreateContainer( | 559 aura::Window* panel_container = CreateContainer( |
| 540 kShellWindowId_PanelContainer, | 560 kShellWindowId_PanelContainer, |
| 541 "PanelContainer", | 561 "PanelContainer", |
| 542 non_lock_screen_containers); | 562 non_lock_screen_containers); |
| 543 SetUsesScreenCoordinates(panel_container); | 563 SetUsesScreenCoordinates(panel_container); |
| 544 | 564 |
| 545 aura::Window* launcher_container = | 565 aura::Window* launcher_container = |
| 546 CreateContainer(kShellWindowId_ShelfContainer, | 566 CreateContainer(kShellWindowId_ShelfContainer, |
| 547 "LauncherContainer", | 567 "LauncherContainer", |
| 548 non_lock_screen_containers); | 568 non_lock_screen_containers); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 "OverlayContainer", | 646 "OverlayContainer", |
| 627 lock_screen_related_containers); | 647 lock_screen_related_containers); |
| 628 SetUsesScreenCoordinates(overlay_container); | 648 SetUsesScreenCoordinates(overlay_container); |
| 629 | 649 |
| 630 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, | 650 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, |
| 631 "PowerButtonAnimationContainer", root_window) ; | 651 "PowerButtonAnimationContainer", root_window) ; |
| 632 } | 652 } |
| 633 | 653 |
| 634 } // namespace internal | 654 } // namespace internal |
| 635 } // namespace ash | 655 } // namespace ash |
| OLD | NEW |