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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 if (config != Config::MASH) | 641 if (config != Config::MASH) |
627 user_metrics_recorder_->OnShellShuttingDown(); | 642 user_metrics_recorder_->OnShellShuttingDown(); |
628 | 643 |
629 shell_delegate_->PreShutdown(); | 644 shell_delegate_->PreShutdown(); |
630 | 645 |
631 // Remove the focus from any window. This will prevent overhead and side | 646 // Remove the focus from any window. This will prevent overhead and side |
632 // effects (e.g. crashes) from changing focus during shutdown. | 647 // effects (e.g. crashes) from changing focus during shutdown. |
633 // See bug crbug.com/134502. | 648 // See bug crbug.com/134502. |
634 aura::client::GetFocusClient(GetPrimaryRootWindow())->FocusWindow(nullptr); | 649 aura::client::GetFocusClient(GetPrimaryRootWindow())->FocusWindow(nullptr); |
635 | 650 |
636 // Please keep in same order as in Init() because it's easy to miss one. | 651 // Please keep in reverse order as in Init() because it's easy to miss one. |
| 652 split_view_controller_.reset(); |
| 653 |
637 if (window_modality_controller_) | 654 if (window_modality_controller_) |
638 window_modality_controller_.reset(); | 655 window_modality_controller_.reset(); |
639 | 656 |
640 RemovePreTargetHandler(magnifier_key_scroll_handler_.get()); | 657 RemovePreTargetHandler(magnifier_key_scroll_handler_.get()); |
641 magnifier_key_scroll_handler_.reset(); | 658 magnifier_key_scroll_handler_.reset(); |
642 | 659 |
643 RemovePreTargetHandler(speech_feedback_handler_.get()); | 660 RemovePreTargetHandler(speech_feedback_handler_.get()); |
644 speech_feedback_handler_.reset(); | 661 speech_feedback_handler_.reset(); |
645 | 662 |
646 RemovePreTargetHandler(overlay_filter_.get()); | 663 RemovePreTargetHandler(overlay_filter_.get()); |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1109 new ui::UserActivityPowerManagerNotifier(user_activity_detector_.get())); | 1126 new ui::UserActivityPowerManagerNotifier(user_activity_detector_.get())); |
1110 video_activity_notifier_.reset( | 1127 video_activity_notifier_.reset( |
1111 new VideoActivityNotifier(video_detector_.get())); | 1128 new VideoActivityNotifier(video_detector_.get())); |
1112 bluetooth_notification_controller_.reset(new BluetoothNotificationController); | 1129 bluetooth_notification_controller_.reset(new BluetoothNotificationController); |
1113 if (ShouldEnableSimplifiedDisplayManagement()) { | 1130 if (ShouldEnableSimplifiedDisplayManagement()) { |
1114 screen_orientation_controller_.reset(new ScreenOrientationController()); | 1131 screen_orientation_controller_.reset(new ScreenOrientationController()); |
1115 screen_layout_observer_.reset(new ScreenLayoutObserver()); | 1132 screen_layout_observer_.reset(new ScreenLayoutObserver()); |
1116 } | 1133 } |
1117 sms_observer_.reset(new SmsObserver()); | 1134 sms_observer_.reset(new SmsObserver()); |
1118 | 1135 |
| 1136 split_view_controller_.reset(new SplitViewController()); |
| 1137 |
1119 // The compositor thread and main message loop have to be running in | 1138 // The compositor thread and main message loop have to be running in |
1120 // order to create mirror window. Run it after the main message loop | 1139 // order to create mirror window. Run it after the main message loop |
1121 // is started. | 1140 // is started. |
1122 if (ShouldEnableSimplifiedDisplayManagement()) | 1141 if (ShouldEnableSimplifiedDisplayManagement()) |
1123 display_manager_->CreateMirrorWindowAsyncIfAny(); | 1142 display_manager_->CreateMirrorWindowAsyncIfAny(); |
1124 | 1143 |
1125 for (auto& observer : shell_observers_) | 1144 for (auto& observer : shell_observers_) |
1126 observer.OnShellInitialized(); | 1145 observer.OnShellInitialized(); |
1127 | 1146 |
1128 if (config != Config::MASH) | 1147 if (config != Config::MASH) |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1284 void Shell::OnPrefServiceInitialized( | 1303 void Shell::OnPrefServiceInitialized( |
1285 std::unique_ptr<::PrefService> pref_service) { | 1304 std::unique_ptr<::PrefService> pref_service) { |
1286 if (!instance_) | 1305 if (!instance_) |
1287 return; | 1306 return; |
1288 // |pref_service_| is null if can't connect to Chrome (as happens when | 1307 // |pref_service_| is null if can't connect to Chrome (as happens when |
1289 // running mash outside of chrome --mash and chrome isn't built). | 1308 // running mash outside of chrome --mash and chrome isn't built). |
1290 pref_service_ = std::move(pref_service); | 1309 pref_service_ = std::move(pref_service); |
1291 } | 1310 } |
1292 | 1311 |
1293 } // namespace ash | 1312 } // namespace ash |
OLD | NEW |