| 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/shell.h" | 5 #include "ash/shell.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "ash/accelerators/accelerator_controller.h" | 10 #include "ash/accelerators/accelerator_controller.h" |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 } | 337 } |
| 338 FOR_EACH_OBSERVER(ShellObserver, observers_, | 338 FOR_EACH_OBSERVER(ShellObserver, observers_, |
| 339 OnDisplayWorkAreaInsetsChanged()); | 339 OnDisplayWorkAreaInsetsChanged()); |
| 340 } | 340 } |
| 341 | 341 |
| 342 void Shell::OnLoginStateChanged(user::LoginStatus status) { | 342 void Shell::OnLoginStateChanged(user::LoginStatus status) { |
| 343 FOR_EACH_OBSERVER(ShellObserver, observers_, OnLoginStateChanged(status)); | 343 FOR_EACH_OBSERVER(ShellObserver, observers_, OnLoginStateChanged(status)); |
| 344 } | 344 } |
| 345 | 345 |
| 346 void Shell::OnLoginUserProfilePrepared() { | 346 void Shell::OnLoginUserProfilePrepared() { |
| 347 CreateLauncher(); | 347 CreateShelf(); |
| 348 CreateKeyboard(); | 348 CreateKeyboard(); |
| 349 } | 349 } |
| 350 | 350 |
| 351 void Shell::UpdateAfterLoginStatusChange(user::LoginStatus status) { | 351 void Shell::UpdateAfterLoginStatusChange(user::LoginStatus status) { |
| 352 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 352 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
| 353 for (RootWindowControllerList::iterator iter = controllers.begin(); | 353 for (RootWindowControllerList::iterator iter = controllers.begin(); |
| 354 iter != controllers.end(); ++iter) | 354 iter != controllers.end(); ++iter) |
| 355 (*iter)->UpdateAfterLoginStatusChange(status); | 355 (*iter)->UpdateAfterLoginStatusChange(status); |
| 356 } | 356 } |
| 357 | 357 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 368 internal::kShellWindowId_LockSystemModalContainer, | 368 internal::kShellWindowId_LockSystemModalContainer, |
| 369 GetPrimaryRootWindow()); | 369 GetPrimaryRootWindow()); |
| 370 for (std::vector<aura::Window*>::const_iterator iter = containers.begin(); | 370 for (std::vector<aura::Window*>::const_iterator iter = containers.begin(); |
| 371 iter != containers.end(); ++iter) { | 371 iter != containers.end(); ++iter) { |
| 372 DCHECK_EQ(0u, (*iter)->children().size()); | 372 DCHECK_EQ(0u, (*iter)->children().size()); |
| 373 } | 373 } |
| 374 } | 374 } |
| 375 #endif | 375 #endif |
| 376 } | 376 } |
| 377 | 377 |
| 378 void Shell::CreateLauncher() { | 378 void Shell::CreateShelf() { |
| 379 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 379 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
| 380 for (RootWindowControllerList::iterator iter = controllers.begin(); | 380 for (RootWindowControllerList::iterator iter = controllers.begin(); |
| 381 iter != controllers.end(); ++iter) | 381 iter != controllers.end(); ++iter) |
| 382 (*iter)->shelf()->CreateLauncher(); | 382 (*iter)->shelf()->CreateShelf(); |
| 383 } | 383 } |
| 384 | 384 |
| 385 void Shell::CreateKeyboard() { | 385 void Shell::CreateKeyboard() { |
| 386 // TODO(bshe): Primary root window controller may not be the controller to | 386 // TODO(bshe): Primary root window controller may not be the controller to |
| 387 // attach virtual keyboard. See http://crbug.com/303429 | 387 // attach virtual keyboard. See http://crbug.com/303429 |
| 388 InitKeyboard(); | 388 InitKeyboard(); |
| 389 if (keyboard::IsKeyboardUsabilityExperimentEnabled()) { | 389 if (keyboard::IsKeyboardUsabilityExperimentEnabled()) { |
| 390 display_controller()->virtual_keyboard_window_controller()-> | 390 display_controller()->virtual_keyboard_window_controller()-> |
| 391 ActivateKeyboard(keyboard_controller_.get()); | 391 ActivateKeyboard(keyboard_controller_.get()); |
| 392 } else { | 392 } else { |
| 393 GetPrimaryRootWindowController()-> | 393 GetPrimaryRootWindowController()-> |
| 394 ActivateKeyboard(keyboard_controller_.get()); | 394 ActivateKeyboard(keyboard_controller_.get()); |
| 395 } | 395 } |
| 396 } | 396 } |
| 397 | 397 |
| 398 void Shell::ShowLauncher() { | 398 void Shell::ShowShelf() { |
| 399 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 399 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
| 400 for (RootWindowControllerList::iterator iter = controllers.begin(); | 400 for (RootWindowControllerList::iterator iter = controllers.begin(); |
| 401 iter != controllers.end(); ++iter) | 401 iter != controllers.end(); ++iter) |
| 402 (*iter)->ShowLauncher(); | 402 (*iter)->ShowShelf(); |
| 403 } | 403 } |
| 404 | 404 |
| 405 void Shell::AddShellObserver(ShellObserver* observer) { | 405 void Shell::AddShellObserver(ShellObserver* observer) { |
| 406 observers_.AddObserver(observer); | 406 observers_.AddObserver(observer); |
| 407 } | 407 } |
| 408 | 408 |
| 409 void Shell::RemoveShellObserver(ShellObserver* observer) { | 409 void Shell::RemoveShellObserver(ShellObserver* observer) { |
| 410 observers_.RemoveObserver(observer); | 410 observers_.RemoveObserver(observer); |
| 411 } | 411 } |
| 412 | 412 |
| 413 void Shell::UpdateShelfVisibility() { | 413 void Shell::UpdateShelfVisibility() { |
| 414 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 414 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
| 415 for (RootWindowControllerList::iterator iter = controllers.begin(); | 415 for (RootWindowControllerList::iterator iter = controllers.begin(); |
| 416 iter != controllers.end(); ++iter) | 416 iter != controllers.end(); ++iter) |
| 417 if ((*iter)->shelf()) | 417 if ((*iter)->shelf()) |
| 418 (*iter)->UpdateShelfVisibility(); | 418 (*iter)->UpdateShelfVisibility(); |
| 419 } | 419 } |
| 420 | 420 |
| 421 void Shell::SetShelfAutoHideBehavior(ShelfAutoHideBehavior behavior, | 421 void Shell::SetShelfAutoHideBehavior(ShelfAutoHideBehavior behavior, |
| 422 aura::Window* root_window) { | 422 aura::Window* root_window) { |
| 423 ash::internal::ShelfLayoutManager::ForLauncher(root_window)-> | 423 ash::internal::ShelfLayoutManager::ForShelf(root_window)-> |
| 424 SetAutoHideBehavior(behavior); | 424 SetAutoHideBehavior(behavior); |
| 425 } | 425 } |
| 426 | 426 |
| 427 ShelfAutoHideBehavior Shell::GetShelfAutoHideBehavior( | 427 ShelfAutoHideBehavior Shell::GetShelfAutoHideBehavior( |
| 428 aura::Window* root_window) const { | 428 aura::Window* root_window) const { |
| 429 return ash::internal::ShelfLayoutManager::ForLauncher(root_window)-> | 429 return ash::internal::ShelfLayoutManager::ForShelf(root_window)-> |
| 430 auto_hide_behavior(); | 430 auto_hide_behavior(); |
| 431 } | 431 } |
| 432 | 432 |
| 433 void Shell::SetShelfAlignment(ShelfAlignment alignment, | 433 void Shell::SetShelfAlignment(ShelfAlignment alignment, |
| 434 aura::Window* root_window) { | 434 aura::Window* root_window) { |
| 435 if (ash::internal::ShelfLayoutManager::ForLauncher(root_window)-> | 435 if (ash::internal::ShelfLayoutManager::ForShelf(root_window)-> |
| 436 SetAlignment(alignment)) { | 436 SetAlignment(alignment)) { |
| 437 FOR_EACH_OBSERVER( | 437 FOR_EACH_OBSERVER( |
| 438 ShellObserver, observers_, OnShelfAlignmentChanged(root_window)); | 438 ShellObserver, observers_, OnShelfAlignmentChanged(root_window)); |
| 439 } | 439 } |
| 440 } | 440 } |
| 441 | 441 |
| 442 ShelfAlignment Shell::GetShelfAlignment(aura::Window* root_window) { | 442 ShelfAlignment Shell::GetShelfAlignment(aura::Window* root_window) { |
| 443 return internal::GetRootWindowController(root_window)-> | 443 return internal::GetRootWindowController(root_window)-> |
| 444 GetShelfLayoutManager()->GetAlignment(); | 444 GetShelfLayoutManager()->GetAlignment(); |
| 445 } | 445 } |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 RemovePreTargetHandler(mouse_cursor_filter_.get()); | 612 RemovePreTargetHandler(mouse_cursor_filter_.get()); |
| 613 RemovePreTargetHandler(system_gesture_filter_.get()); | 613 RemovePreTargetHandler(system_gesture_filter_.get()); |
| 614 RemovePreTargetHandler(keyboard_metrics_filter_.get()); | 614 RemovePreTargetHandler(keyboard_metrics_filter_.get()); |
| 615 RemovePreTargetHandler(event_transformation_handler_.get()); | 615 RemovePreTargetHandler(event_transformation_handler_.get()); |
| 616 RemovePreTargetHandler(accelerator_filter_.get()); | 616 RemovePreTargetHandler(accelerator_filter_.get()); |
| 617 | 617 |
| 618 // TooltipController is deleted with the Shell so removing its references. | 618 // TooltipController is deleted with the Shell so removing its references. |
| 619 RemovePreTargetHandler(tooltip_controller_.get()); | 619 RemovePreTargetHandler(tooltip_controller_.get()); |
| 620 | 620 |
| 621 // AppList needs to be released before shelf layout manager, which is | 621 // AppList needs to be released before shelf layout manager, which is |
| 622 // destroyed with launcher container in the loop below. However, app list | 622 // destroyed with shelf container in the loop below. However, app list |
| 623 // container is now on top of launcher container and released after it. | 623 // container is now on top of shelf container and released after it. |
| 624 // TODO(xiyuan): Move it back when app list container is no longer needed. | 624 // TODO(xiyuan): Move it back when app list container is no longer needed. |
| 625 app_list_controller_.reset(); | 625 app_list_controller_.reset(); |
| 626 | 626 |
| 627 // Destroy SystemTrayDelegate before destroying the status area(s). | 627 // Destroy SystemTrayDelegate before destroying the status area(s). |
| 628 system_tray_delegate_->Shutdown(); | 628 system_tray_delegate_->Shutdown(); |
| 629 system_tray_delegate_.reset(); | 629 system_tray_delegate_.reset(); |
| 630 | 630 |
| 631 locale_notification_controller_.reset(); | 631 locale_notification_controller_.reset(); |
| 632 | 632 |
| 633 // Drag-and-drop must be canceled prior to close all windows. | 633 // Drag-and-drop must be canceled prior to close all windows. |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 output_configurator_->set_mirroring_controller(display_manager_.get()); | 746 output_configurator_->set_mirroring_controller(display_manager_.get()); |
| 747 output_configurator_->Start( | 747 output_configurator_->Start( |
| 748 delegate_->IsFirstRunAfterBoot() ? kChromeOsBootColor : 0); | 748 delegate_->IsFirstRunAfterBoot() ? kChromeOsBootColor : 0); |
| 749 display_initialized = true; | 749 display_initialized = true; |
| 750 } | 750 } |
| 751 #endif // defined(OS_CHROMEOS) && defined(USE_X11) | 751 #endif // defined(OS_CHROMEOS) && defined(USE_X11) |
| 752 if (!display_initialized) | 752 if (!display_initialized) |
| 753 display_manager_->InitDefaultDisplay(); | 753 display_manager_->InitDefaultDisplay(); |
| 754 | 754 |
| 755 // Install the custom factory first so that views::FocusManagers for Tray, | 755 // Install the custom factory first so that views::FocusManagers for Tray, |
| 756 // Launcher, and WallPaper could be created by the factory. | 756 // Shelf, and WallPaper could be created by the factory. |
| 757 views::FocusManagerFactory::Install(new AshFocusManagerFactory); | 757 views::FocusManagerFactory::Install(new AshFocusManagerFactory); |
| 758 | 758 |
| 759 // Env creates the compositor. Historically it seems to have been implicitly | 759 // Env creates the compositor. Historically it seems to have been implicitly |
| 760 // initialized first by the ActivationController, but now that FocusController | 760 // initialized first by the ActivationController, but now that FocusController |
| 761 // no longer does this we need to do it explicitly. | 761 // no longer does this we need to do it explicitly. |
| 762 aura::Env::CreateInstance(); | 762 aura::Env::CreateInstance(); |
| 763 | 763 |
| 764 // The WindowModalityController needs to be at the front of the input event | 764 // The WindowModalityController needs to be at the front of the input event |
| 765 // pretarget handler list to ensure that it processes input events when modal | 765 // pretarget handler list to ensure that it processes input events when modal |
| 766 // windows are active. | 766 // windows are active. |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1030 //////////////////////////////////////////////////////////////////////////////// | 1030 //////////////////////////////////////////////////////////////////////////////// |
| 1031 // Shell, aura::client::ActivationChangeObserver implementation: | 1031 // Shell, aura::client::ActivationChangeObserver implementation: |
| 1032 | 1032 |
| 1033 void Shell::OnWindowActivated(aura::Window* gained_active, | 1033 void Shell::OnWindowActivated(aura::Window* gained_active, |
| 1034 aura::Window* lost_active) { | 1034 aura::Window* lost_active) { |
| 1035 if (gained_active) | 1035 if (gained_active) |
| 1036 target_root_window_ = gained_active->GetRootWindow(); | 1036 target_root_window_ = gained_active->GetRootWindow(); |
| 1037 } | 1037 } |
| 1038 | 1038 |
| 1039 } // namespace ash | 1039 } // namespace ash |
| OLD | NEW |