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