| 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_manager.h" | 12 #include "ash/display/display_manager.h" |
| 13 #include "ash/focus_cycler.h" | 13 #include "ash/focus_cycler.h" |
| 14 #include "ash/session_state_delegate.h" | 14 #include "ash/session_state_delegate.h" |
| 15 #include "ash/shelf/shelf_layout_manager.h" | 15 #include "ash/shelf/shelf_layout_manager.h" |
| 16 #include "ash/shelf/shelf_types.h" | 16 #include "ash/shelf/shelf_types.h" |
| 17 #include "ash/shelf/shelf_widget.h" | 17 #include "ash/shelf/shelf_widget.h" |
| 18 #include "ash/shell.h" | 18 #include "ash/shell.h" |
| 19 #include "ash/shell_delegate.h" | 19 #include "ash/shell_delegate.h" |
| 20 #include "ash/shell_factory.h" | 20 #include "ash/shell_factory.h" |
| 21 #include "ash/shell_window_ids.h" | 21 #include "ash/shell_window_ids.h" |
| 22 #include "ash/system/status_area_widget.h" | 22 #include "ash/system/status_area_widget.h" |
| 23 #include "ash/system/tray/system_tray_delegate.h" | 23 #include "ash/system/tray/system_tray_delegate.h" |
| 24 #include "ash/touch/touch_observer_hud.h" | 24 #include "ash/touch/touch_hud_debug.h" |
| 25 #include "ash/touch/touch_hud_projection.h" |
| 25 #include "ash/wm/base_layout_manager.h" | 26 #include "ash/wm/base_layout_manager.h" |
| 26 #include "ash/wm/boot_splash_screen.h" | 27 #include "ash/wm/boot_splash_screen.h" |
| 27 #include "ash/wm/dock/docked_window_layout_manager.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/panels/panel_window_event_handler.h" | 30 #include "ash/wm/panels/panel_window_event_handler.h" |
| 30 #include "ash/wm/property_util.h" | 31 #include "ash/wm/property_util.h" |
| 31 #include "ash/wm/root_window_layout_manager.h" | 32 #include "ash/wm/root_window_layout_manager.h" |
| 32 #include "ash/wm/screen_dimmer.h" | 33 #include "ash/wm/screen_dimmer.h" |
| 33 #include "ash/wm/stacking_controller.h" | 34 #include "ash/wm/stacking_controller.h" |
| 34 #include "ash/wm/status_area_layout_manager.h" | 35 #include "ash/wm/status_area_layout_manager.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 163 |
| 163 } // namespace | 164 } // namespace |
| 164 | 165 |
| 165 namespace internal { | 166 namespace internal { |
| 166 | 167 |
| 167 RootWindowController::RootWindowController(aura::RootWindow* root_window) | 168 RootWindowController::RootWindowController(aura::RootWindow* root_window) |
| 168 : root_window_(root_window), | 169 : root_window_(root_window), |
| 169 root_window_layout_(NULL), | 170 root_window_layout_(NULL), |
| 170 docked_layout_manager_(NULL), | 171 docked_layout_manager_(NULL), |
| 171 panel_layout_manager_(NULL), | 172 panel_layout_manager_(NULL), |
| 172 touch_observer_hud_(NULL) { | 173 touch_hud_debug_(NULL), |
| 174 touch_hud_projection_(NULL) { |
| 173 SetRootWindowController(root_window, this); | 175 SetRootWindowController(root_window, this); |
| 174 screen_dimmer_.reset(new ScreenDimmer(root_window)); | 176 screen_dimmer_.reset(new ScreenDimmer(root_window)); |
| 175 | 177 |
| 176 stacking_controller_.reset(new ash::StackingController); | 178 stacking_controller_.reset(new ash::StackingController); |
| 177 aura::client::SetStackingClient(root_window, stacking_controller_.get()); | 179 aura::client::SetStackingClient(root_window, stacking_controller_.get()); |
| 178 } | 180 } |
| 179 | 181 |
| 180 RootWindowController::~RootWindowController() { | 182 RootWindowController::~RootWindowController() { |
| 181 Shutdown(); | 183 Shutdown(); |
| 182 root_window_.reset(); | 184 root_window_.reset(); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 // so that the behavior and construction order is consistent betwheen Ash | 298 // so that the behavior and construction order is consistent betwheen Ash |
| 297 // and Chrome. | 299 // and Chrome. |
| 298 if (Shell::GetInstance()->session_state_delegate()->NumberOfLoggedInUsers()) | 300 if (Shell::GetInstance()->session_state_delegate()->NumberOfLoggedInUsers()) |
| 299 shelf_->CreateLauncher(); | 301 shelf_->CreateLauncher(); |
| 300 | 302 |
| 301 InitKeyboard(); | 303 InitKeyboard(); |
| 302 } | 304 } |
| 303 | 305 |
| 304 void RootWindowController::CreateContainers() { | 306 void RootWindowController::CreateContainers() { |
| 305 CreateContainersInRootWindow(root_window_.get()); | 307 CreateContainersInRootWindow(root_window_.get()); |
| 306 | |
| 307 // Create touch observer HUD if needed. HUD should be created after the | |
| 308 // containers have been created, so that its widget can be added to them. | |
| 309 CommandLine* command_line = CommandLine::ForCurrentProcess(); | |
| 310 if (command_line->HasSwitch(switches::kAshTouchHud)) | |
| 311 touch_observer_hud_ = new TouchObserverHUD(root_window_.get()); | |
| 312 } | 308 } |
| 313 | 309 |
| 314 void RootWindowController::CreateSystemBackground( | 310 void RootWindowController::CreateSystemBackground( |
| 315 bool is_first_run_after_boot) { | 311 bool is_first_run_after_boot) { |
| 316 SkColor color = SK_ColorBLACK; | 312 SkColor color = SK_ColorBLACK; |
| 317 #if defined(OS_CHROMEOS) | 313 #if defined(OS_CHROMEOS) |
| 318 if (is_first_run_after_boot) | 314 if (is_first_run_after_boot) |
| 319 color = kChromeOsBootColor; | 315 color = kChromeOsBootColor; |
| 320 #endif | 316 #endif |
| 321 system_background_.reset( | 317 system_background_.reset( |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 shelf_.reset(NULL); | 403 shelf_.reset(NULL); |
| 408 } | 404 } |
| 409 | 405 |
| 410 void RootWindowController::MoveWindowsTo(aura::RootWindow* dst) { | 406 void RootWindowController::MoveWindowsTo(aura::RootWindow* dst) { |
| 411 // Forget the shelf early so that shelf don't update itself using wrong | 407 // Forget the shelf early so that shelf don't update itself using wrong |
| 412 // display info. | 408 // display info. |
| 413 workspace_controller_->SetShelf(NULL); | 409 workspace_controller_->SetShelf(NULL); |
| 414 ReparentAllWindows(root_window_.get(), dst); | 410 ReparentAllWindows(root_window_.get(), dst); |
| 415 } | 411 } |
| 416 | 412 |
| 413 void RootWindowController::EnableTouchHudProjection() { |
| 414 if (touch_hud_projection_) |
| 415 return; |
| 416 set_touch_hud_projection(new TouchHudProjection(root_window_.get())); |
| 417 } |
| 418 |
| 419 void RootWindowController::DisableTouchHudProjection() { |
| 420 if (!touch_hud_projection_) |
| 421 return; |
| 422 touch_hud_projection_->Remove(); |
| 423 } |
| 424 |
| 417 ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() { | 425 ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() { |
| 418 return shelf_.get() ? shelf_->shelf_layout_manager() : NULL; | 426 return shelf_.get() ? shelf_->shelf_layout_manager() : NULL; |
| 419 } | 427 } |
| 420 | 428 |
| 421 SystemTray* RootWindowController::GetSystemTray() { | 429 SystemTray* RootWindowController::GetSystemTray() { |
| 422 // We assume in throughout the code that this will not return NULL. If code | 430 // We assume in throughout the code that this will not return NULL. If code |
| 423 // triggers this for valid reasons, it should test status_area_widget first. | 431 // triggers this for valid reasons, it should test status_area_widget first. |
| 424 CHECK(shelf_.get() && shelf_->status_area_widget()); | 432 CHECK(shelf_.get() && shelf_->status_area_widget()); |
| 425 return shelf_->status_area_widget()->system_tray(); | 433 return shelf_->status_area_widget()->system_tray(); |
| 426 } | 434 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 449 return; | 457 return; |
| 450 } | 458 } |
| 451 | 459 |
| 452 Shell::GetInstance()->UpdateShelfVisibility(); | 460 Shell::GetInstance()->UpdateShelfVisibility(); |
| 453 } | 461 } |
| 454 | 462 |
| 455 void RootWindowController::UpdateShelfVisibility() { | 463 void RootWindowController::UpdateShelfVisibility() { |
| 456 shelf_->shelf_layout_manager()->UpdateVisibilityState(); | 464 shelf_->shelf_layout_manager()->UpdateVisibilityState(); |
| 457 } | 465 } |
| 458 | 466 |
| 467 void RootWindowController::InitTouchHuds() { |
| 468 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 469 if (command_line->HasSwitch(switches::kAshTouchHud)) |
| 470 set_touch_hud_debug(new TouchHudDebug(root_window_.get())); |
| 471 if (Shell::GetInstance()->is_touch_hud_projection_enabled()) |
| 472 EnableTouchHudProjection(); |
| 473 } |
| 474 |
| 459 aura::Window* RootWindowController::GetFullscreenWindow() const { | 475 aura::Window* RootWindowController::GetFullscreenWindow() const { |
| 460 aura::Window* container = workspace_controller_->GetActiveWorkspaceWindow(); | 476 aura::Window* container = workspace_controller_->GetActiveWorkspaceWindow(); |
| 461 for (size_t i = 0; i < container->children().size(); ++i) { | 477 for (size_t i = 0; i < container->children().size(); ++i) { |
| 462 aura::Window* child = container->children()[i]; | 478 aura::Window* child = container->children()[i]; |
| 463 if (ash::wm::IsWindowFullscreen(child)) | 479 if (ash::wm::IsWindowFullscreen(child)) |
| 464 return child; | 480 return child; |
| 465 } | 481 } |
| 466 return NULL; | 482 return NULL; |
| 467 } | 483 } |
| 468 | 484 |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 "OverlayContainer", | 662 "OverlayContainer", |
| 647 lock_screen_related_containers); | 663 lock_screen_related_containers); |
| 648 SetUsesScreenCoordinates(overlay_container); | 664 SetUsesScreenCoordinates(overlay_container); |
| 649 | 665 |
| 650 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, | 666 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, |
| 651 "PowerButtonAnimationContainer", root_window) ; | 667 "PowerButtonAnimationContainer", root_window) ; |
| 652 } | 668 } |
| 653 | 669 |
| 654 } // namespace internal | 670 } // namespace internal |
| 655 } // namespace ash | 671 } // namespace ash |
| OLD | NEW |