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/maximize_mode/maximize_mode_window_manager.h" | 101 #include "ash/wm/maximize_mode/maximize_mode_window_manager.h" |
102 #include "ash/wm/mru_window_tracker.h" | 102 #include "ash/wm/mru_window_tracker.h" |
103 #include "ash/wm/native_cursor_manager_ash_classic.h" | 103 #include "ash/wm/native_cursor_manager_ash_classic.h" |
104 #include "ash/wm/native_cursor_manager_ash_mus.h" | 104 #include "ash/wm/native_cursor_manager_ash_mus.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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 native_cursor_manager_->SetNativeCursorEnabled(!enabled); | 461 native_cursor_manager_->SetNativeCursorEnabled(!enabled); |
461 } | 462 } |
462 } | 463 } |
463 | 464 |
464 void Shell::DoInitialWorkspaceAnimation() { | 465 void Shell::DoInitialWorkspaceAnimation() { |
465 return GetPrimaryRootWindowController() | 466 return GetPrimaryRootWindowController() |
466 ->workspace_controller() | 467 ->workspace_controller() |
467 ->DoInitialAnimation(); | 468 ->DoInitialAnimation(); |
468 } | 469 } |
469 | 470 |
| 471 bool Shell::IsSplitViewModeActive() const { |
| 472 return split_view_controller_->IsSplitViewModeActive(); |
| 473 } |
| 474 |
470 void Shell::AddShellObserver(ShellObserver* observer) { | 475 void Shell::AddShellObserver(ShellObserver* observer) { |
471 shell_observers_.AddObserver(observer); | 476 shell_observers_.AddObserver(observer); |
472 } | 477 } |
473 | 478 |
474 void Shell::RemoveShellObserver(ShellObserver* observer) { | 479 void Shell::RemoveShellObserver(ShellObserver* observer) { |
475 shell_observers_.RemoveObserver(observer); | 480 shell_observers_.RemoveObserver(observer); |
476 } | 481 } |
477 | 482 |
478 void Shell::ShowAppList() { | 483 void Shell::ShowAppList() { |
479 // Show the app list on the default display for new windows. | 484 // Show the app list on the default display for new windows. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 void Shell::NotifyOverviewModeStarting() { | 530 void Shell::NotifyOverviewModeStarting() { |
526 for (auto& observer : shell_observers_) | 531 for (auto& observer : shell_observers_) |
527 observer.OnOverviewModeStarting(); | 532 observer.OnOverviewModeStarting(); |
528 } | 533 } |
529 | 534 |
530 void Shell::NotifyOverviewModeEnded() { | 535 void Shell::NotifyOverviewModeEnded() { |
531 for (auto& observer : shell_observers_) | 536 for (auto& observer : shell_observers_) |
532 observer.OnOverviewModeEnded(); | 537 observer.OnOverviewModeEnded(); |
533 } | 538 } |
534 | 539 |
| 540 void Shell::NotifySplitViewModeStarting() { |
| 541 for (auto& observer : shell_observers_) |
| 542 observer.OnSplitViewModeStarting(); |
| 543 } |
| 544 |
| 545 void Shell::NotifySplitViewModeEnded() { |
| 546 for (auto& observer : shell_observers_) |
| 547 observer.OnSplitViewModeEnded(); |
| 548 } |
| 549 |
535 void Shell::NotifyFullscreenStateChanged(bool is_fullscreen, | 550 void Shell::NotifyFullscreenStateChanged(bool is_fullscreen, |
536 aura::Window* root_window) { | 551 aura::Window* root_window) { |
537 for (auto& observer : shell_observers_) | 552 for (auto& observer : shell_observers_) |
538 observer.OnFullscreenStateChanged(is_fullscreen, root_window); | 553 observer.OnFullscreenStateChanged(is_fullscreen, root_window); |
539 } | 554 } |
540 | 555 |
541 void Shell::NotifyPinnedStateChanged(aura::Window* pinned_window) { | 556 void Shell::NotifyPinnedStateChanged(aura::Window* pinned_window) { |
542 for (auto& observer : shell_observers_) | 557 for (auto& observer : shell_observers_) |
543 observer.OnPinnedStateChanged(pinned_window); | 558 observer.OnPinnedStateChanged(pinned_window); |
544 } | 559 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 if (config != Config::MASH) | 649 if (config != Config::MASH) |
635 user_metrics_recorder_->OnShellShuttingDown(); | 650 user_metrics_recorder_->OnShellShuttingDown(); |
636 | 651 |
637 shell_delegate_->PreShutdown(); | 652 shell_delegate_->PreShutdown(); |
638 | 653 |
639 // Remove the focus from any window. This will prevent overhead and side | 654 // Remove the focus from any window. This will prevent overhead and side |
640 // effects (e.g. crashes) from changing focus during shutdown. | 655 // effects (e.g. crashes) from changing focus during shutdown. |
641 // See bug crbug.com/134502. | 656 // See bug crbug.com/134502. |
642 aura::client::GetFocusClient(GetPrimaryRootWindow())->FocusWindow(nullptr); | 657 aura::client::GetFocusClient(GetPrimaryRootWindow())->FocusWindow(nullptr); |
643 | 658 |
644 // Please keep in same order as in Init() because it's easy to miss one. | 659 // Please keep in reverse order as in Init() because it's easy to miss one. |
| 660 split_view_controller_.reset(); |
| 661 |
645 if (window_modality_controller_) | 662 if (window_modality_controller_) |
646 window_modality_controller_.reset(); | 663 window_modality_controller_.reset(); |
647 | 664 |
648 RemovePreTargetHandler(magnifier_key_scroll_handler_.get()); | 665 RemovePreTargetHandler(magnifier_key_scroll_handler_.get()); |
649 magnifier_key_scroll_handler_.reset(); | 666 magnifier_key_scroll_handler_.reset(); |
650 | 667 |
651 RemovePreTargetHandler(speech_feedback_handler_.get()); | 668 RemovePreTargetHandler(speech_feedback_handler_.get()); |
652 speech_feedback_handler_.reset(); | 669 speech_feedback_handler_.reset(); |
653 | 670 |
654 RemovePreTargetHandler(overlay_filter_.get()); | 671 RemovePreTargetHandler(overlay_filter_.get()); |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1110 user_activity_notifier_.reset( | 1127 user_activity_notifier_.reset( |
1111 new ui::UserActivityPowerManagerNotifier(user_activity_detector_.get())); | 1128 new ui::UserActivityPowerManagerNotifier(user_activity_detector_.get())); |
1112 video_activity_notifier_.reset( | 1129 video_activity_notifier_.reset( |
1113 new VideoActivityNotifier(video_detector_.get())); | 1130 new VideoActivityNotifier(video_detector_.get())); |
1114 bluetooth_notification_controller_.reset(new BluetoothNotificationController); | 1131 bluetooth_notification_controller_.reset(new BluetoothNotificationController); |
1115 screen_orientation_controller_ = | 1132 screen_orientation_controller_ = |
1116 base::MakeUnique<ScreenOrientationController>(); | 1133 base::MakeUnique<ScreenOrientationController>(); |
1117 screen_layout_observer_.reset(new ScreenLayoutObserver()); | 1134 screen_layout_observer_.reset(new ScreenLayoutObserver()); |
1118 sms_observer_.reset(new SmsObserver()); | 1135 sms_observer_.reset(new SmsObserver()); |
1119 | 1136 |
| 1137 split_view_controller_.reset(new SplitViewController()); |
| 1138 |
1120 // The compositor thread and main message loop have to be running in | 1139 // The compositor thread and main message loop have to be running in |
1121 // order to create mirror window. Run it after the main message loop | 1140 // order to create mirror window. Run it after the main message loop |
1122 // is started. | 1141 // is started. |
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) |
1129 user_metrics_recorder_->OnShellInitialized(); | 1148 user_metrics_recorder_->OnShellInitialized(); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1275 void Shell::OnPrefServiceInitialized( | 1294 void Shell::OnPrefServiceInitialized( |
1276 std::unique_ptr<::PrefService> pref_service) { | 1295 std::unique_ptr<::PrefService> pref_service) { |
1277 if (!instance_) | 1296 if (!instance_) |
1278 return; | 1297 return; |
1279 // |pref_service_| is null if can't connect to Chrome (as happens when | 1298 // |pref_service_| is null if can't connect to Chrome (as happens when |
1280 // running mash outside of chrome --mash and chrome isn't built). | 1299 // running mash outside of chrome --mash and chrome isn't built). |
1281 pref_service_ = std::move(pref_service); | 1300 pref_service_ = std::move(pref_service); |
1282 } | 1301 } |
1283 | 1302 |
1284 } // namespace ash | 1303 } // namespace ash |
OLD | NEW |