| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 #include "ash/wm/lock_state_controller.h" | 101 #include "ash/wm/lock_state_controller.h" |
| 102 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | 102 #include "ash/wm/maximize_mode/maximize_mode_controller.h" |
| 103 #include "ash/wm/maximize_mode/maximize_mode_window_manager.h" | 103 #include "ash/wm/maximize_mode/maximize_mode_window_manager.h" |
| 104 #include "ash/wm/mru_window_tracker.h" | 104 #include "ash/wm/mru_window_tracker.h" |
| 105 #include "ash/wm/overlay_event_filter.h" | 105 #include "ash/wm/overlay_event_filter.h" |
| 106 #include "ash/wm/overview/window_selector_controller.h" | 106 #include "ash/wm/overview/window_selector_controller.h" |
| 107 #include "ash/wm/power_button_controller.h" | 107 #include "ash/wm/power_button_controller.h" |
| 108 #include "ash/wm/resize_shadow_controller.h" | 108 #include "ash/wm/resize_shadow_controller.h" |
| 109 #include "ash/wm/root_window_finder.h" | 109 #include "ash/wm/root_window_finder.h" |
| 110 #include "ash/wm/screen_pinning_controller.h" | 110 #include "ash/wm/screen_pinning_controller.h" |
| 111 #include "ash/wm/splitview/split_view_controller.h" |
| 111 #include "ash/wm/system_gesture_event_filter.h" | 112 #include "ash/wm/system_gesture_event_filter.h" |
| 112 #include "ash/wm/system_modal_container_event_filter.h" | 113 #include "ash/wm/system_modal_container_event_filter.h" |
| 113 #include "ash/wm/system_modal_container_layout_manager.h" | 114 #include "ash/wm/system_modal_container_layout_manager.h" |
| 114 #include "ash/wm/toplevel_window_event_handler.h" | 115 #include "ash/wm/toplevel_window_event_handler.h" |
| 115 #include "ash/wm/video_detector.h" | 116 #include "ash/wm/video_detector.h" |
| 116 #include "ash/wm/window_animations.h" | 117 #include "ash/wm/window_animations.h" |
| 117 #include "ash/wm/window_cycle_controller.h" | 118 #include "ash/wm/window_cycle_controller.h" |
| 118 #include "ash/wm/window_positioner.h" | 119 #include "ash/wm/window_positioner.h" |
| 119 #include "ash/wm/window_properties.h" | 120 #include "ash/wm/window_properties.h" |
| 120 #include "ash/wm/window_util.h" | 121 #include "ash/wm/window_util.h" |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 native_cursor_manager_->SetNativeCursorEnabled(!enabled); | 446 native_cursor_manager_->SetNativeCursorEnabled(!enabled); |
| 446 } | 447 } |
| 447 } | 448 } |
| 448 | 449 |
| 449 void Shell::DoInitialWorkspaceAnimation() { | 450 void Shell::DoInitialWorkspaceAnimation() { |
| 450 return GetPrimaryRootWindowController() | 451 return GetPrimaryRootWindowController() |
| 451 ->workspace_controller() | 452 ->workspace_controller() |
| 452 ->DoInitialAnimation(); | 453 ->DoInitialAnimation(); |
| 453 } | 454 } |
| 454 | 455 |
| 456 bool Shell::IsSplitViewModeActive() const { |
| 457 return split_view_controller_->IsSplitViewModeActive(); |
| 458 } |
| 459 |
| 455 void Shell::AddShellObserver(ShellObserver* observer) { | 460 void Shell::AddShellObserver(ShellObserver* observer) { |
| 456 shell_observers_.AddObserver(observer); | 461 shell_observers_.AddObserver(observer); |
| 457 } | 462 } |
| 458 | 463 |
| 459 void Shell::RemoveShellObserver(ShellObserver* observer) { | 464 void Shell::RemoveShellObserver(ShellObserver* observer) { |
| 460 shell_observers_.RemoveObserver(observer); | 465 shell_observers_.RemoveObserver(observer); |
| 461 } | 466 } |
| 462 | 467 |
| 463 void Shell::ShowAppList() { | 468 void Shell::ShowAppList() { |
| 464 // Show the app list on the default display for new windows. | 469 // Show the app list on the default display for new windows. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 void Shell::NotifyOverviewModeStarting() { | 515 void Shell::NotifyOverviewModeStarting() { |
| 511 for (auto& observer : shell_observers_) | 516 for (auto& observer : shell_observers_) |
| 512 observer.OnOverviewModeStarting(); | 517 observer.OnOverviewModeStarting(); |
| 513 } | 518 } |
| 514 | 519 |
| 515 void Shell::NotifyOverviewModeEnded() { | 520 void Shell::NotifyOverviewModeEnded() { |
| 516 for (auto& observer : shell_observers_) | 521 for (auto& observer : shell_observers_) |
| 517 observer.OnOverviewModeEnded(); | 522 observer.OnOverviewModeEnded(); |
| 518 } | 523 } |
| 519 | 524 |
| 525 void Shell::NotifySplitViewModeStarting() { |
| 526 for (auto& observer : shell_observers_) |
| 527 observer.OnSplitViewModeStarting(); |
| 528 } |
| 529 |
| 530 void Shell::NotifySplitViewModeEnded() { |
| 531 for (auto& observer : shell_observers_) |
| 532 observer.OnSplitViewModeEnded(); |
| 533 } |
| 534 |
| 520 void Shell::NotifyFullscreenStateChanged(bool is_fullscreen, | 535 void Shell::NotifyFullscreenStateChanged(bool is_fullscreen, |
| 521 aura::Window* root_window) { | 536 aura::Window* root_window) { |
| 522 for (auto& observer : shell_observers_) | 537 for (auto& observer : shell_observers_) |
| 523 observer.OnFullscreenStateChanged(is_fullscreen, root_window); | 538 observer.OnFullscreenStateChanged(is_fullscreen, root_window); |
| 524 } | 539 } |
| 525 | 540 |
| 526 void Shell::NotifyPinnedStateChanged(aura::Window* pinned_window) { | 541 void Shell::NotifyPinnedStateChanged(aura::Window* pinned_window) { |
| 527 for (auto& observer : shell_observers_) | 542 for (auto& observer : shell_observers_) |
| 528 observer.OnPinnedStateChanged(pinned_window); | 543 observer.OnPinnedStateChanged(pinned_window); |
| 529 } | 544 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 if (config != Config::MASH) | 640 if (config != Config::MASH) |
| 626 user_metrics_recorder_->OnShellShuttingDown(); | 641 user_metrics_recorder_->OnShellShuttingDown(); |
| 627 | 642 |
| 628 shell_delegate_->PreShutdown(); | 643 shell_delegate_->PreShutdown(); |
| 629 | 644 |
| 630 // Remove the focus from any window. This will prevent overhead and side | 645 // Remove the focus from any window. This will prevent overhead and side |
| 631 // effects (e.g. crashes) from changing focus during shutdown. | 646 // effects (e.g. crashes) from changing focus during shutdown. |
| 632 // See bug crbug.com/134502. | 647 // See bug crbug.com/134502. |
| 633 aura::client::GetFocusClient(GetPrimaryRootWindow())->FocusWindow(nullptr); | 648 aura::client::GetFocusClient(GetPrimaryRootWindow())->FocusWindow(nullptr); |
| 634 | 649 |
| 635 // Please keep in same order as in Init() because it's easy to miss one. | 650 // Please keep in reverse order as in Init() because it's easy to miss one. |
| 651 split_view_controller_.reset(); |
| 652 |
| 636 if (window_modality_controller_) | 653 if (window_modality_controller_) |
| 637 window_modality_controller_.reset(); | 654 window_modality_controller_.reset(); |
| 638 | 655 |
| 639 RemovePreTargetHandler(magnifier_key_scroll_handler_.get()); | 656 RemovePreTargetHandler(magnifier_key_scroll_handler_.get()); |
| 640 magnifier_key_scroll_handler_.reset(); | 657 magnifier_key_scroll_handler_.reset(); |
| 641 | 658 |
| 642 RemovePreTargetHandler(speech_feedback_handler_.get()); | 659 RemovePreTargetHandler(speech_feedback_handler_.get()); |
| 643 speech_feedback_handler_.reset(); | 660 speech_feedback_handler_.reset(); |
| 644 | 661 |
| 645 RemovePreTargetHandler(overlay_filter_.get()); | 662 RemovePreTargetHandler(overlay_filter_.get()); |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1108 new ui::UserActivityPowerManagerNotifier(user_activity_detector_.get())); | 1125 new ui::UserActivityPowerManagerNotifier(user_activity_detector_.get())); |
| 1109 video_activity_notifier_.reset( | 1126 video_activity_notifier_.reset( |
| 1110 new VideoActivityNotifier(video_detector_.get())); | 1127 new VideoActivityNotifier(video_detector_.get())); |
| 1111 bluetooth_notification_controller_.reset(new BluetoothNotificationController); | 1128 bluetooth_notification_controller_.reset(new BluetoothNotificationController); |
| 1112 if (ShouldEnableSimplifiedDisplayManagement()) { | 1129 if (ShouldEnableSimplifiedDisplayManagement()) { |
| 1113 screen_orientation_controller_.reset(new ScreenOrientationController()); | 1130 screen_orientation_controller_.reset(new ScreenOrientationController()); |
| 1114 screen_layout_observer_.reset(new ScreenLayoutObserver()); | 1131 screen_layout_observer_.reset(new ScreenLayoutObserver()); |
| 1115 } | 1132 } |
| 1116 sms_observer_.reset(new SmsObserver()); | 1133 sms_observer_.reset(new SmsObserver()); |
| 1117 | 1134 |
| 1135 split_view_controller_.reset(new SplitViewController()); |
| 1136 |
| 1118 // The compositor thread and main message loop have to be running in | 1137 // The compositor thread and main message loop have to be running in |
| 1119 // order to create mirror window. Run it after the main message loop | 1138 // order to create mirror window. Run it after the main message loop |
| 1120 // is started. | 1139 // is started. |
| 1121 if (ShouldEnableSimplifiedDisplayManagement()) | 1140 if (ShouldEnableSimplifiedDisplayManagement()) |
| 1122 display_manager_->CreateMirrorWindowAsyncIfAny(); | 1141 display_manager_->CreateMirrorWindowAsyncIfAny(); |
| 1123 | 1142 |
| 1124 for (auto& observer : shell_observers_) | 1143 for (auto& observer : shell_observers_) |
| 1125 observer.OnShellInitialized(); | 1144 observer.OnShellInitialized(); |
| 1126 | 1145 |
| 1127 if (config != Config::MASH) | 1146 if (config != Config::MASH) |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1283 void Shell::OnPrefServiceInitialized( | 1302 void Shell::OnPrefServiceInitialized( |
| 1284 std::unique_ptr<::PrefService> pref_service) { | 1303 std::unique_ptr<::PrefService> pref_service) { |
| 1285 if (!instance_) | 1304 if (!instance_) |
| 1286 return; | 1305 return; |
| 1287 // |pref_service_| is null if can't connect to Chrome (as happens when | 1306 // |pref_service_| is null if can't connect to Chrome (as happens when |
| 1288 // running mash outside of chrome --mash and chrome isn't built). | 1307 // running mash outside of chrome --mash and chrome isn't built). |
| 1289 pref_service_ = std::move(pref_service); | 1308 pref_service_ = std::move(pref_service); |
| 1290 } | 1309 } |
| 1291 | 1310 |
| 1292 } // namespace ash | 1311 } // namespace ash |
| OLD | NEW |