| 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 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 #include "ash/virtual_keyboard_controller.h" | 91 #include "ash/virtual_keyboard_controller.h" |
| 92 #include "ash/wallpaper/wallpaper_controller.h" | 92 #include "ash/wallpaper/wallpaper_controller.h" |
| 93 #include "ash/wallpaper/wallpaper_delegate.h" | 93 #include "ash/wallpaper/wallpaper_delegate.h" |
| 94 #include "ash/wm/ash_focus_rules.h" | 94 #include "ash/wm/ash_focus_rules.h" |
| 95 #include "ash/wm/ash_native_cursor_manager.h" | 95 #include "ash/wm/ash_native_cursor_manager.h" |
| 96 #include "ash/wm/container_finder.h" | 96 #include "ash/wm/container_finder.h" |
| 97 #include "ash/wm/event_client_impl.h" | 97 #include "ash/wm/event_client_impl.h" |
| 98 #include "ash/wm/immersive_context_ash.h" | 98 #include "ash/wm/immersive_context_ash.h" |
| 99 #include "ash/wm/immersive_handler_factory_ash.h" | 99 #include "ash/wm/immersive_handler_factory_ash.h" |
| 100 #include "ash/wm/lock_state_controller.h" | 100 #include "ash/wm/lock_state_controller.h" |
| 101 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | |
| 102 #include "ash/wm/maximize_mode/maximize_mode_window_manager.h" | |
| 103 #include "ash/wm/mru_window_tracker.h" | 101 #include "ash/wm/mru_window_tracker.h" |
| 104 #include "ash/wm/overlay_event_filter.h" | 102 #include "ash/wm/overlay_event_filter.h" |
| 105 #include "ash/wm/overview/window_selector_controller.h" | 103 #include "ash/wm/overview/window_selector_controller.h" |
| 106 #include "ash/wm/power_button_controller.h" | 104 #include "ash/wm/power_button_controller.h" |
| 107 #include "ash/wm/resize_shadow_controller.h" | 105 #include "ash/wm/resize_shadow_controller.h" |
| 108 #include "ash/wm/root_window_finder.h" | 106 #include "ash/wm/root_window_finder.h" |
| 109 #include "ash/wm/screen_pinning_controller.h" | 107 #include "ash/wm/screen_pinning_controller.h" |
| 110 #include "ash/wm/system_gesture_event_filter.h" | 108 #include "ash/wm/system_gesture_event_filter.h" |
| 111 #include "ash/wm/system_modal_container_event_filter.h" | 109 #include "ash/wm/system_modal_container_event_filter.h" |
| 112 #include "ash/wm/system_modal_container_layout_manager.h" | 110 #include "ash/wm/system_modal_container_layout_manager.h" |
| 111 #include "ash/wm/tablet_mode/tablet_mode_controller.h" |
| 112 #include "ash/wm/tablet_mode/tablet_mode_window_manager.h" |
| 113 #include "ash/wm/toplevel_window_event_handler.h" | 113 #include "ash/wm/toplevel_window_event_handler.h" |
| 114 #include "ash/wm/video_detector.h" | 114 #include "ash/wm/video_detector.h" |
| 115 #include "ash/wm/window_animations.h" | 115 #include "ash/wm/window_animations.h" |
| 116 #include "ash/wm/window_cycle_controller.h" | 116 #include "ash/wm/window_cycle_controller.h" |
| 117 #include "ash/wm/window_positioner.h" | 117 #include "ash/wm/window_positioner.h" |
| 118 #include "ash/wm/window_properties.h" | 118 #include "ash/wm/window_properties.h" |
| 119 #include "ash/wm/window_util.h" | 119 #include "ash/wm/window_util.h" |
| 120 #include "ash/wm/workspace_controller.h" | 120 #include "ash/wm/workspace_controller.h" |
| 121 #include "ash/wm_window.h" | 121 #include "ash/wm_window.h" |
| 122 #include "base/bind.h" | 122 #include "base/bind.h" |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 return app_list_->GetTargetVisibility(); | 480 return app_list_->GetTargetVisibility(); |
| 481 } | 481 } |
| 482 | 482 |
| 483 void Shell::UpdateAfterLoginStatusChange(LoginStatus status) { | 483 void Shell::UpdateAfterLoginStatusChange(LoginStatus status) { |
| 484 for (WmWindow* root_window : shell_port_->GetAllRootWindows()) { | 484 for (WmWindow* root_window : shell_port_->GetAllRootWindows()) { |
| 485 root_window->GetRootWindowController()->UpdateAfterLoginStatusChange( | 485 root_window->GetRootWindowController()->UpdateAfterLoginStatusChange( |
| 486 status); | 486 status); |
| 487 } | 487 } |
| 488 } | 488 } |
| 489 | 489 |
| 490 void Shell::NotifyMaximizeModeStarted() { | 490 void Shell::NotifyTabletModeStarted() { |
| 491 for (auto& observer : shell_observers_) | 491 for (auto& observer : shell_observers_) |
| 492 observer.OnMaximizeModeStarted(); | 492 observer.OnTabletModeStarted(); |
| 493 } | 493 } |
| 494 | 494 |
| 495 void Shell::NotifyMaximizeModeEnding() { | 495 void Shell::NotifyTabletModeEnding() { |
| 496 for (auto& observer : shell_observers_) | 496 for (auto& observer : shell_observers_) |
| 497 observer.OnMaximizeModeEnding(); | 497 observer.OnTabletModeEnding(); |
| 498 } | 498 } |
| 499 | 499 |
| 500 void Shell::NotifyMaximizeModeEnded() { | 500 void Shell::NotifyTabletModeEnded() { |
| 501 for (auto& observer : shell_observers_) | 501 for (auto& observer : shell_observers_) |
| 502 observer.OnMaximizeModeEnded(); | 502 observer.OnTabletModeEnded(); |
| 503 } | 503 } |
| 504 | 504 |
| 505 void Shell::NotifyOverviewModeStarting() { | 505 void Shell::NotifyOverviewModeStarting() { |
| 506 for (auto& observer : shell_observers_) | 506 for (auto& observer : shell_observers_) |
| 507 observer.OnOverviewModeStarting(); | 507 observer.OnOverviewModeStarting(); |
| 508 } | 508 } |
| 509 | 509 |
| 510 void Shell::NotifyOverviewModeEnded() { | 510 void Shell::NotifyOverviewModeEnded() { |
| 511 for (auto& observer : shell_observers_) | 511 for (auto& observer : shell_observers_) |
| 512 observer.OnOverviewModeEnded(); | 512 observer.OnOverviewModeEnded(); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 RemovePreTargetHandler(mouse_cursor_filter_.get()); | 640 RemovePreTargetHandler(mouse_cursor_filter_.get()); |
| 641 } | 641 } |
| 642 RemovePreTargetHandler(modality_filter_.get()); | 642 RemovePreTargetHandler(modality_filter_.get()); |
| 643 | 643 |
| 644 // TooltipController is deleted with the Shell so removing its references. | 644 // TooltipController is deleted with the Shell so removing its references. |
| 645 RemovePreTargetHandler(tooltip_controller_.get()); | 645 RemovePreTargetHandler(tooltip_controller_.get()); |
| 646 | 646 |
| 647 screen_orientation_controller_.reset(); | 647 screen_orientation_controller_.reset(); |
| 648 screen_layout_observer_.reset(); | 648 screen_layout_observer_.reset(); |
| 649 | 649 |
| 650 // Destroy the virtual keyboard controller before the maximize mode controller | 650 // Destroy the virtual keyboard controller before the tablet mode controller |
| 651 // since the latters destructor triggers events that the former is listening | 651 // since the latters destructor triggers events that the former is listening |
| 652 // to but no longer cares about. | 652 // to but no longer cares about. |
| 653 virtual_keyboard_controller_.reset(); | 653 virtual_keyboard_controller_.reset(); |
| 654 | 654 |
| 655 // Destroy maximize mode controller early on since it has some observers which | 655 // Destroy tablet mode controller early on since it has some observers which |
| 656 // need to be removed. | 656 // need to be removed. |
| 657 maximize_mode_controller_.reset(); | 657 tablet_mode_controller_.reset(); |
| 658 | 658 |
| 659 // Destroy the keyboard before closing the shelf, since it will invoke a shelf | 659 // Destroy the keyboard before closing the shelf, since it will invoke a shelf |
| 660 // layout. | 660 // layout. |
| 661 DeactivateKeyboard(); | 661 DeactivateKeyboard(); |
| 662 | 662 |
| 663 toast_manager_.reset(); | 663 toast_manager_.reset(); |
| 664 | 664 |
| 665 // Destroy SystemTrayDelegate before destroying the status area(s). Make sure | 665 // Destroy SystemTrayDelegate before destroying the status area(s). Make sure |
| 666 // to deinitialize the shelf first, as it is initialized after the delegate. | 666 // to deinitialize the shelf first, as it is initialized after the delegate. |
| 667 for (WmWindow* root : shell_port_->GetAllRootWindows()) | 667 for (WmWindow* root : shell_port_->GetAllRootWindows()) |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 943 resolution_notification_controller_.reset( | 943 resolution_notification_controller_.reset( |
| 944 new ResolutionNotificationController); | 944 new ResolutionNotificationController); |
| 945 } | 945 } |
| 946 | 946 |
| 947 if (cursor_manager_) { | 947 if (cursor_manager_) { |
| 948 cursor_manager_->SetDisplay( | 948 cursor_manager_->SetDisplay( |
| 949 display::Screen::GetScreen()->GetPrimaryDisplay()); | 949 display::Screen::GetScreen()->GetPrimaryDisplay()); |
| 950 } | 950 } |
| 951 | 951 |
| 952 accelerator_controller_ = shell_port_->CreateAcceleratorController(); | 952 accelerator_controller_ = shell_port_->CreateAcceleratorController(); |
| 953 maximize_mode_controller_ = base::MakeUnique<MaximizeModeController>(); | 953 tablet_mode_controller_ = base::MakeUnique<TabletModeController>(); |
| 954 | 954 |
| 955 magnifier_key_scroll_handler_ = MagnifierKeyScroller::CreateHandler(); | 955 magnifier_key_scroll_handler_ = MagnifierKeyScroller::CreateHandler(); |
| 956 AddPreTargetHandler(magnifier_key_scroll_handler_.get()); | 956 AddPreTargetHandler(magnifier_key_scroll_handler_.get()); |
| 957 speech_feedback_handler_ = SpokenFeedbackToggler::CreateHandler(); | 957 speech_feedback_handler_ = SpokenFeedbackToggler::CreateHandler(); |
| 958 AddPreTargetHandler(speech_feedback_handler_.get()); | 958 AddPreTargetHandler(speech_feedback_handler_.get()); |
| 959 | 959 |
| 960 // The order in which event filters are added is significant. | 960 // The order in which event filters are added is significant. |
| 961 | 961 |
| 962 // ui::UserActivityDetector passes events to observers, so let them get | 962 // ui::UserActivityDetector passes events to observers, so let them get |
| 963 // rewritten first. | 963 // rewritten first. |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1269 void Shell::OnPrefServiceInitialized( | 1269 void Shell::OnPrefServiceInitialized( |
| 1270 std::unique_ptr<::PrefService> pref_service) { | 1270 std::unique_ptr<::PrefService> pref_service) { |
| 1271 if (!instance_) | 1271 if (!instance_) |
| 1272 return; | 1272 return; |
| 1273 // |pref_service_| is null if can't connect to Chrome (as happens when | 1273 // |pref_service_| is null if can't connect to Chrome (as happens when |
| 1274 // running mash outside of chrome --mash and chrome isn't built). | 1274 // running mash outside of chrome --mash and chrome isn't built). |
| 1275 pref_service_ = std::move(pref_service); | 1275 pref_service_ = std::move(pref_service); |
| 1276 } | 1276 } |
| 1277 | 1277 |
| 1278 } // namespace ash | 1278 } // namespace ash |
| OLD | NEW |