| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 | 645 |
| 631 user_metrics_recorder_->OnShellShuttingDown(); | 646 user_metrics_recorder_->OnShellShuttingDown(); |
| 632 | 647 |
| 633 shell_delegate_->PreShutdown(); | 648 shell_delegate_->PreShutdown(); |
| 634 | 649 |
| 635 // Remove the focus from any window. This will prevent overhead and side | 650 // Remove the focus from any window. This will prevent overhead and side |
| 636 // effects (e.g. crashes) from changing focus during shutdown. | 651 // effects (e.g. crashes) from changing focus during shutdown. |
| 637 // See bug crbug.com/134502. | 652 // See bug crbug.com/134502. |
| 638 aura::client::GetFocusClient(GetPrimaryRootWindow())->FocusWindow(nullptr); | 653 aura::client::GetFocusClient(GetPrimaryRootWindow())->FocusWindow(nullptr); |
| 639 | 654 |
| 640 // Please keep in same order as in Init() because it's easy to miss one. | 655 // Please keep in reverse order as in Init() because it's easy to miss one. |
| 656 split_view_controller_.reset(); |
| 657 |
| 641 if (window_modality_controller_) | 658 if (window_modality_controller_) |
| 642 window_modality_controller_.reset(); | 659 window_modality_controller_.reset(); |
| 643 | 660 |
| 644 RemovePreTargetHandler(magnifier_key_scroll_handler_.get()); | 661 RemovePreTargetHandler(magnifier_key_scroll_handler_.get()); |
| 645 magnifier_key_scroll_handler_.reset(); | 662 magnifier_key_scroll_handler_.reset(); |
| 646 | 663 |
| 647 RemovePreTargetHandler(speech_feedback_handler_.get()); | 664 RemovePreTargetHandler(speech_feedback_handler_.get()); |
| 648 speech_feedback_handler_.reset(); | 665 speech_feedback_handler_.reset(); |
| 649 | 666 |
| 650 RemovePreTargetHandler(overlay_filter_.get()); | 667 RemovePreTargetHandler(overlay_filter_.get()); |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1096 user_activity_notifier_.reset( | 1113 user_activity_notifier_.reset( |
| 1097 new ui::UserActivityPowerManagerNotifier(user_activity_detector_.get())); | 1114 new ui::UserActivityPowerManagerNotifier(user_activity_detector_.get())); |
| 1098 video_activity_notifier_.reset( | 1115 video_activity_notifier_.reset( |
| 1099 new VideoActivityNotifier(video_detector_.get())); | 1116 new VideoActivityNotifier(video_detector_.get())); |
| 1100 bluetooth_notification_controller_.reset(new BluetoothNotificationController); | 1117 bluetooth_notification_controller_.reset(new BluetoothNotificationController); |
| 1101 screen_orientation_controller_ = | 1118 screen_orientation_controller_ = |
| 1102 base::MakeUnique<ScreenOrientationController>(); | 1119 base::MakeUnique<ScreenOrientationController>(); |
| 1103 screen_layout_observer_.reset(new ScreenLayoutObserver()); | 1120 screen_layout_observer_.reset(new ScreenLayoutObserver()); |
| 1104 sms_observer_.reset(new SmsObserver()); | 1121 sms_observer_.reset(new SmsObserver()); |
| 1105 | 1122 |
| 1123 split_view_controller_.reset(new SplitViewController()); |
| 1124 |
| 1106 // The compositor thread and main message loop have to be running in | 1125 // The compositor thread and main message loop have to be running in |
| 1107 // order to create mirror window. Run it after the main message loop | 1126 // order to create mirror window. Run it after the main message loop |
| 1108 // is started. | 1127 // is started. |
| 1109 display_manager_->CreateMirrorWindowAsyncIfAny(); | 1128 display_manager_->CreateMirrorWindowAsyncIfAny(); |
| 1110 | 1129 |
| 1111 for (auto& observer : shell_observers_) | 1130 for (auto& observer : shell_observers_) |
| 1112 observer.OnShellInitialized(); | 1131 observer.OnShellInitialized(); |
| 1113 | 1132 |
| 1114 user_metrics_recorder_->OnShellInitialized(); | 1133 user_metrics_recorder_->OnShellInitialized(); |
| 1115 } | 1134 } |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1264 void Shell::OnPrefServiceInitialized( | 1283 void Shell::OnPrefServiceInitialized( |
| 1265 std::unique_ptr<::PrefService> pref_service) { | 1284 std::unique_ptr<::PrefService> pref_service) { |
| 1266 if (!instance_) | 1285 if (!instance_) |
| 1267 return; | 1286 return; |
| 1268 // |pref_service_| is null if can't connect to Chrome (as happens when | 1287 // |pref_service_| is null if can't connect to Chrome (as happens when |
| 1269 // running mash outside of chrome --mash and chrome isn't built). | 1288 // running mash outside of chrome --mash and chrome isn't built). |
| 1270 pref_service_ = std::move(pref_service); | 1289 pref_service_ = std::move(pref_service); |
| 1271 } | 1290 } |
| 1272 | 1291 |
| 1273 } // namespace ash | 1292 } // namespace ash |
| OLD | NEW |