| 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 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "ash/accelerators/accelerator_controller_delegate_aura.h" | 11 #include "ash/accelerators/accelerator_controller_delegate_aura.h" |
| 12 #include "ash/accelerators/accelerator_delegate.h" | 12 #include "ash/accelerators/accelerator_delegate.h" |
| 13 #include "ash/aura/wm_shell_aura.h" | 13 #include "ash/aura/wm_shell_aura.h" |
| 14 #include "ash/aura/wm_window_aura.h" | 14 #include "ash/aura/wm_window_aura.h" |
| 15 #include "ash/autoclick/autoclick_controller.h" | 15 #include "ash/autoclick/autoclick_controller.h" |
| 16 #include "ash/common/accelerators/accelerator_controller.h" | 16 #include "ash/common/accelerators/accelerator_controller.h" |
| 17 #include "ash/common/ash_switches.h" | 17 #include "ash/common/ash_switches.h" |
| 18 #include "ash/common/frame/custom_frame_view_ash.h" | 18 #include "ash/common/frame/custom_frame_view_ash.h" |
| 19 #include "ash/common/gpu_support.h" | 19 #include "ash/common/gpu_support.h" |
| 20 #include "ash/common/keyboard/keyboard_ui.h" | 20 #include "ash/common/keyboard/keyboard_ui.h" |
| 21 #include "ash/common/login_status.h" | 21 #include "ash/common/login_status.h" |
| 22 #include "ash/common/session/session_state_delegate.h" | 22 #include "ash/common/session/session_state_delegate.h" |
| 23 #include "ash/common/shelf/app_list_shelf_item_delegate.h" | 23 #include "ash/common/shelf/app_list_shelf_item_delegate.h" |
| 24 #include "ash/common/shelf/shelf_delegate.h" | 24 #include "ash/common/shelf/shelf_delegate.h" |
| 25 #include "ash/common/shelf/shelf_item_delegate.h" | 25 #include "ash/common/shelf/shelf_item_delegate.h" |
| 26 #include "ash/common/shelf/shelf_model.h" | 26 #include "ash/common/shelf/shelf_model.h" |
| 27 #include "ash/common/shelf/shelf_widget.h" | 27 #include "ash/common/shelf/wm_shelf.h" |
| 28 #include "ash/common/shell_delegate.h" | 28 #include "ash/common/shell_delegate.h" |
| 29 #include "ash/common/shell_window_ids.h" | 29 #include "ash/common/shell_window_ids.h" |
| 30 #include "ash/common/system/locale/locale_notification_controller.h" | 30 #include "ash/common/system/locale/locale_notification_controller.h" |
| 31 #include "ash/common/system/status_area_widget.h" | 31 #include "ash/common/system/status_area_widget.h" |
| 32 #include "ash/common/system/tray/system_tray_delegate.h" | 32 #include "ash/common/system/tray/system_tray_delegate.h" |
| 33 #include "ash/common/wallpaper/wallpaper_delegate.h" | 33 #include "ash/common/wallpaper/wallpaper_delegate.h" |
| 34 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 34 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
| 35 #include "ash/common/wm/maximize_mode/maximize_mode_window_manager.h" | 35 #include "ash/common/wm/maximize_mode/maximize_mode_window_manager.h" |
| 36 #include "ash/common/wm/mru_window_tracker.h" | 36 #include "ash/common/wm/mru_window_tracker.h" |
| 37 #include "ash/common/wm/root_window_finder.h" | 37 #include "ash/common/wm/root_window_finder.h" |
| 38 #include "ash/common/wm/window_positioner.h" | 38 #include "ash/common/wm/window_positioner.h" |
| 39 #include "ash/common/wm/workspace_controller.h" | 39 #include "ash/common/wm/workspace_controller.h" |
| 40 #include "ash/common/wm_root_window_controller.h" |
| 40 #include "ash/common/wm_shell.h" | 41 #include "ash/common/wm_shell.h" |
| 41 #include "ash/display/cursor_window_controller.h" | 42 #include "ash/display/cursor_window_controller.h" |
| 42 #include "ash/display/display_configuration_controller.h" | 43 #include "ash/display/display_configuration_controller.h" |
| 43 #include "ash/display/display_manager.h" | 44 #include "ash/display/display_manager.h" |
| 44 #include "ash/display/event_transformation_handler.h" | 45 #include "ash/display/event_transformation_handler.h" |
| 45 #include "ash/display/mouse_cursor_event_filter.h" | 46 #include "ash/display/mouse_cursor_event_filter.h" |
| 46 #include "ash/display/screen_position_controller.h" | 47 #include "ash/display/screen_position_controller.h" |
| 47 #include "ash/display/window_tree_host_manager.h" | 48 #include "ash/display/window_tree_host_manager.h" |
| 48 #include "ash/drag_drop/drag_drop_controller.h" | 49 #include "ash/drag_drop/drag_drop_controller.h" |
| 49 #include "ash/first_run/first_run_helper_impl.h" | 50 #include "ash/first_run/first_run_helper_impl.h" |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 keyboard::KeyboardController::ResetInstance(nullptr); | 399 keyboard::KeyboardController::ResetInstance(nullptr); |
| 399 } | 400 } |
| 400 | 401 |
| 401 void Shell::ShowShelf() { | 402 void Shell::ShowShelf() { |
| 402 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 403 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
| 403 for (RootWindowControllerList::iterator iter = controllers.begin(); | 404 for (RootWindowControllerList::iterator iter = controllers.begin(); |
| 404 iter != controllers.end(); ++iter) | 405 iter != controllers.end(); ++iter) |
| 405 (*iter)->ShowShelf(); | 406 (*iter)->ShowShelf(); |
| 406 } | 407 } |
| 407 | 408 |
| 408 void Shell::ShutdownShelf() { | |
| 409 RootWindowControllerList controllers = GetAllRootWindowControllers(); | |
| 410 for (RootWindowControllerList::iterator iter = controllers.begin(); | |
| 411 iter != controllers.end(); ++iter) { | |
| 412 if ((*iter)->shelf_widget()) | |
| 413 (*iter)->shelf_widget()->Shutdown(); | |
| 414 } | |
| 415 } | |
| 416 | |
| 417 #if defined(OS_CHROMEOS) | 409 #if defined(OS_CHROMEOS) |
| 418 bool Shell::ShouldSaveDisplaySettings() { | 410 bool Shell::ShouldSaveDisplaySettings() { |
| 419 return !( | 411 return !( |
| 420 screen_orientation_controller_->ignore_display_configuration_updates() || | 412 screen_orientation_controller_->ignore_display_configuration_updates() || |
| 421 resolution_notification_controller_->DoesNotificationTimeout()); | 413 resolution_notification_controller_->DoesNotificationTimeout()); |
| 422 } | 414 } |
| 423 #endif | 415 #endif |
| 424 | 416 |
| 425 void Shell::UpdateShelfVisibility() { | 417 void Shell::UpdateShelfVisibility() { |
| 426 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 418 for (WmWindow* root : wm_shell_->GetAllRootWindows()) |
| 427 for (RootWindowControllerList::iterator iter = controllers.begin(); | 419 root->GetRootWindowController()->GetShelf()->UpdateVisibilityState(); |
| 428 iter != controllers.end(); ++iter) | |
| 429 if ((*iter)->shelf_widget()) | |
| 430 (*iter)->UpdateShelfVisibility(); | |
| 431 } | 420 } |
| 432 | 421 |
| 433 void Shell::CreateModalBackground(aura::Window* window) { | 422 void Shell::CreateModalBackground(aura::Window* window) { |
| 434 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 423 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
| 435 for (RootWindowControllerList::iterator iter = controllers.begin(); | 424 for (RootWindowControllerList::iterator iter = controllers.begin(); |
| 436 iter != controllers.end(); ++iter) | 425 iter != controllers.end(); ++iter) |
| 437 (*iter)->GetSystemModalLayoutManager(window)->CreateModalBackground(); | 426 (*iter)->GetSystemModalLayoutManager(window)->CreateModalBackground(); |
| 438 } | 427 } |
| 439 | 428 |
| 440 void Shell::OnModalWindowRemoved(aura::Window* removed) { | 429 void Shell::OnModalWindowRemoved(aura::Window* removed) { |
| 441 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 430 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
| 442 bool activated = false; | 431 bool activated = false; |
| 443 for (RootWindowControllerList::iterator iter = controllers.begin(); | 432 for (RootWindowControllerList::iterator iter = controllers.begin(); |
| 444 iter != controllers.end() && !activated; ++iter) { | 433 iter != controllers.end() && !activated; ++iter) { |
| 445 activated = (*iter) | 434 activated = (*iter) |
| 446 ->GetSystemModalLayoutManager(removed) | 435 ->GetSystemModalLayoutManager(removed) |
| 447 ->ActivateNextModalWindow(); | 436 ->ActivateNextModalWindow(); |
| 448 } | 437 } |
| 449 if (!activated) { | 438 if (!activated) { |
| 450 for (RootWindowControllerList::iterator iter = controllers.begin(); | 439 for (RootWindowControllerList::iterator iter = controllers.begin(); |
| 451 iter != controllers.end(); ++iter) | 440 iter != controllers.end(); ++iter) |
| 452 (*iter)->GetSystemModalLayoutManager(removed)->DestroyModalBackground(); | 441 (*iter)->GetSystemModalLayoutManager(removed)->DestroyModalBackground(); |
| 453 } | 442 } |
| 454 } | 443 } |
| 455 | 444 |
| 456 WebNotificationTray* Shell::GetWebNotificationTray() { | 445 WebNotificationTray* Shell::GetWebNotificationTray() { |
| 457 return GetPrimaryRootWindowController() | 446 return GetPrimaryRootWindowController() |
| 458 ->shelf_widget() | 447 ->GetStatusAreaWidget() |
| 459 ->status_area_widget() | |
| 460 ->web_notification_tray(); | 448 ->web_notification_tray(); |
| 461 } | 449 } |
| 462 | 450 |
| 463 bool Shell::HasPrimaryStatusArea() { | 451 bool Shell::HasPrimaryStatusArea() { |
| 464 ShelfWidget* shelf = GetPrimaryRootWindowController()->shelf_widget(); | 452 return !!GetPrimaryRootWindowController()->GetStatusAreaWidget(); |
| 465 return shelf && shelf->status_area_widget(); | |
| 466 } | 453 } |
| 467 | 454 |
| 468 SystemTray* Shell::GetPrimarySystemTray() { | 455 SystemTray* Shell::GetPrimarySystemTray() { |
| 469 return GetPrimaryRootWindowController()->GetSystemTray(); | 456 return GetPrimaryRootWindowController()->GetSystemTray(); |
| 470 } | 457 } |
| 471 | 458 |
| 472 void Shell::SetTouchHudProjectionEnabled(bool enabled) { | 459 void Shell::SetTouchHudProjectionEnabled(bool enabled) { |
| 473 if (is_touch_hud_projection_enabled_ == enabled) | 460 if (is_touch_hud_projection_enabled_ == enabled) |
| 474 return; | 461 return; |
| 475 | 462 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 | 564 |
| 578 // Destroy the keyboard before closing the shelf, since it will invoke a shelf | 565 // Destroy the keyboard before closing the shelf, since it will invoke a shelf |
| 579 // layout. | 566 // layout. |
| 580 DeactivateKeyboard(); | 567 DeactivateKeyboard(); |
| 581 | 568 |
| 582 // Destroy toasts | 569 // Destroy toasts |
| 583 wm_shell_->DeleteToastManager(); | 570 wm_shell_->DeleteToastManager(); |
| 584 | 571 |
| 585 // Destroy SystemTrayDelegate before destroying the status area(s). Make sure | 572 // Destroy SystemTrayDelegate before destroying the status area(s). Make sure |
| 586 // to deinitialize the shelf first, as it is initialized after the delegate. | 573 // to deinitialize the shelf first, as it is initialized after the delegate. |
| 587 ShutdownShelf(); | 574 for (WmWindow* root : wm_shell_->GetAllRootWindows()) |
| 575 root->GetRootWindowController()->GetShelf()->ShutdownShelfWidget(); |
| 588 wm_shell_->DeleteSystemTrayDelegate(); | 576 wm_shell_->DeleteSystemTrayDelegate(); |
| 589 | 577 |
| 590 locale_notification_controller_.reset(); | 578 locale_notification_controller_.reset(); |
| 591 | 579 |
| 592 // Drag-and-drop must be canceled prior to close all windows. | 580 // Drag-and-drop must be canceled prior to close all windows. |
| 593 drag_drop_controller_.reset(); | 581 drag_drop_controller_.reset(); |
| 594 | 582 |
| 595 // Controllers who have WindowObserver added must be deleted | 583 // Controllers who have WindowObserver added must be deleted |
| 596 // before |window_tree_host_manager_| is deleted. | 584 // before |window_tree_host_manager_| is deleted. |
| 597 | 585 |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1034 std::unique_ptr<ui::EventTargetIterator> Shell::GetChildIterator() const { | 1022 std::unique_ptr<ui::EventTargetIterator> Shell::GetChildIterator() const { |
| 1035 return std::unique_ptr<ui::EventTargetIterator>(); | 1023 return std::unique_ptr<ui::EventTargetIterator>(); |
| 1036 } | 1024 } |
| 1037 | 1025 |
| 1038 ui::EventTargeter* Shell::GetEventTargeter() { | 1026 ui::EventTargeter* Shell::GetEventTargeter() { |
| 1039 NOTREACHED(); | 1027 NOTREACHED(); |
| 1040 return nullptr; | 1028 return nullptr; |
| 1041 } | 1029 } |
| 1042 | 1030 |
| 1043 } // namespace ash | 1031 } // namespace ash |
| OLD | NEW |