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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
218 | 218 |
219 //////////////////////////////////////////////////////////////////////////////// | 219 //////////////////////////////////////////////////////////////////////////////// |
220 // Shell, public: | 220 // Shell, public: |
221 | 221 |
222 // static | 222 // static |
223 Shell* Shell::CreateInstance(const ShellInitParams& init_params) { | 223 Shell* Shell::CreateInstance(const ShellInitParams& init_params) { |
224 CHECK(!instance_); | 224 CHECK(!instance_); |
225 ShellPort* shell_port = init_params.shell_port; | 225 ShellPort* shell_port = init_params.shell_port; |
226 if (!shell_port) | 226 if (!shell_port) |
227 shell_port = new ShellPortClassic(); | 227 shell_port = new ShellPortClassic(); |
228 instance_ = new Shell(base::WrapUnique<ShellDelegate>(init_params.delegate), | 228 Shell* shell = |
msw
2017/04/12 17:46:59
q: Is there a reason for changing when Shell::inst
sky
2017/04/12 17:53:18
Ya, sorry, good question. The issue is that GetAsh
msw
2017/04/12 18:03:08
Gotcha.
| |
229 base::WrapUnique<ShellPort>(shell_port)); | 229 new Shell(base::WrapUnique<ShellDelegate>(init_params.delegate), |
230 instance_->Init(init_params); | 230 base::WrapUnique<ShellPort>(shell_port)); |
231 return instance_; | 231 shell->Init(init_params); |
232 return shell; | |
232 } | 233 } |
233 | 234 |
234 // static | 235 // static |
235 Shell* Shell::Get() { | 236 Shell* Shell::Get() { |
236 CHECK(instance_); | 237 CHECK(instance_); |
237 return instance_; | 238 return instance_; |
238 } | 239 } |
239 | 240 |
240 // static | 241 // static |
241 bool Shell::HasInstance() { | 242 bool Shell::HasInstance() { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
356 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 357 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
357 for (RootWindowControllerList::iterator iter = controllers.begin(); | 358 for (RootWindowControllerList::iterator iter = controllers.begin(); |
358 iter != controllers.end(); ++iter) { | 359 iter != controllers.end(); ++iter) { |
359 (*iter)->DeactivateKeyboard(keyboard::KeyboardController::GetInstance()); | 360 (*iter)->DeactivateKeyboard(keyboard::KeyboardController::GetInstance()); |
360 } | 361 } |
361 } | 362 } |
362 keyboard::KeyboardController::ResetInstance(nullptr); | 363 keyboard::KeyboardController::ResetInstance(nullptr); |
363 } | 364 } |
364 | 365 |
365 bool Shell::ShouldSaveDisplaySettings() { | 366 bool Shell::ShouldSaveDisplaySettings() { |
366 DCHECK(!shell_port_->IsRunningInMash()); | 367 DCHECK(GetAshConfig() != Config::MASH); |
367 return !( | 368 return !( |
368 screen_orientation_controller_->ignore_display_configuration_updates() || | 369 screen_orientation_controller_->ignore_display_configuration_updates() || |
369 resolution_notification_controller_->DoesNotificationTimeout()); | 370 resolution_notification_controller_->DoesNotificationTimeout()); |
370 } | 371 } |
371 | 372 |
372 ShelfModel* Shell::shelf_model() { | 373 ShelfModel* Shell::shelf_model() { |
373 return shelf_controller_->model(); | 374 return shelf_controller_->model(); |
374 } | 375 } |
375 | 376 |
376 aura::client::ActivationClient* Shell::activation_client() { | 377 aura::client::ActivationClient* Shell::activation_client() { |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
564 app_list_(base::MakeUnique<app_list::AppList>()), | 565 app_list_(base::MakeUnique<app_list::AppList>()), |
565 link_handler_model_factory_(nullptr), | 566 link_handler_model_factory_(nullptr), |
566 tray_bluetooth_helper_(base::MakeUnique<TrayBluetoothHelper>()), | 567 tray_bluetooth_helper_(base::MakeUnique<TrayBluetoothHelper>()), |
567 display_configurator_(new display::DisplayConfigurator()), | 568 display_configurator_(new display::DisplayConfigurator()), |
568 native_cursor_manager_(nullptr), | 569 native_cursor_manager_(nullptr), |
569 simulate_modal_window_open_for_testing_(false), | 570 simulate_modal_window_open_for_testing_(false), |
570 is_touch_hud_projection_enabled_(false) { | 571 is_touch_hud_projection_enabled_(false) { |
571 // TODO(sky): better refactor cash/mash dependencies. Perhaps put all cash | 572 // TODO(sky): better refactor cash/mash dependencies. Perhaps put all cash |
572 // state on ShellPortClassic. http://crbug.com/671246. | 573 // state on ShellPortClassic. http://crbug.com/671246. |
573 | 574 |
574 if (!shell_port_->IsRunningInMash()) { | 575 instance_ = this; |
576 | |
577 if (GetAshConfig() != Config::MASH) { | |
575 gpu_support_.reset(shell_delegate_->CreateGPUSupport()); | 578 gpu_support_.reset(shell_delegate_->CreateGPUSupport()); |
576 display_manager_.reset(ScreenAsh::CreateDisplayManager()); | 579 display_manager_.reset(ScreenAsh::CreateDisplayManager()); |
577 window_tree_host_manager_.reset(new WindowTreeHostManager); | 580 window_tree_host_manager_.reset(new WindowTreeHostManager); |
578 user_metrics_recorder_.reset(new UserMetricsRecorder); | 581 user_metrics_recorder_.reset(new UserMetricsRecorder); |
579 } | 582 } |
580 | 583 |
581 PowerStatus::Initialize(); | 584 PowerStatus::Initialize(); |
582 | 585 |
583 session_controller_->AddSessionStateObserver(this); | 586 session_controller_->AddSessionStateObserver(this); |
584 } | 587 } |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
762 session_controller_->RemoveSessionStateObserver(this); | 765 session_controller_->RemoveSessionStateObserver(this); |
763 wallpaper_delegate_.reset(); | 766 wallpaper_delegate_.reset(); |
764 pref_service_ = nullptr; | 767 pref_service_ = nullptr; |
765 shell_delegate_.reset(); | 768 shell_delegate_.reset(); |
766 | 769 |
767 DCHECK(instance_ == this); | 770 DCHECK(instance_ == this); |
768 instance_ = nullptr; | 771 instance_ = nullptr; |
769 } | 772 } |
770 | 773 |
771 void Shell::Init(const ShellInitParams& init_params) { | 774 void Shell::Init(const ShellInitParams& init_params) { |
772 const bool is_mash = shell_port_->IsRunningInMash(); | |
773 const Config config = shell_port_->GetAshConfig(); | 775 const Config config = shell_port_->GetAshConfig(); |
774 | 776 |
775 blocking_pool_ = init_params.blocking_pool; | 777 blocking_pool_ = init_params.blocking_pool; |
776 | 778 |
777 wallpaper_delegate_ = shell_delegate_->CreateWallpaperDelegate(); | 779 wallpaper_delegate_ = shell_delegate_->CreateWallpaperDelegate(); |
778 | 780 |
779 // Can be null in tests. | 781 // Can be null in tests. |
780 if (shell_port_->IsRunningInMash() && shell_delegate_->GetShellConnector()) { | 782 if (config == Config::MASH && shell_delegate_->GetShellConnector()) { |
781 prefs::ConnectToPrefService( | 783 prefs::ConnectToPrefService( |
782 shell_delegate_->GetShellConnector(), | 784 shell_delegate_->GetShellConnector(), |
783 make_scoped_refptr(new PrefRegistrySimple()), | 785 make_scoped_refptr(new PrefRegistrySimple()), |
784 std::vector<PrefValueStore::PrefStoreType>(), | 786 std::vector<PrefValueStore::PrefStoreType>(), |
785 base::Bind(&Shell::OnPrefServiceInitialized, base::Unretained(this)), | 787 base::Bind(&Shell::OnPrefServiceInitialized, base::Unretained(this)), |
786 prefs::mojom::kForwarderServiceName); | 788 prefs::mojom::kForwarderServiceName); |
787 } | 789 } |
788 | 790 |
789 // Some delegates access ShellPort during their construction. Create them here | 791 // Some delegates access ShellPort during their construction. Create them here |
790 // instead of the ShellPort constructor. | 792 // instead of the ShellPort constructor. |
(...skipping 13 matching lines...) Expand all Loading... | |
804 auto dom_backend = base::MakeUnique<devtools::AshDevToolsDOMAgent>(); | 806 auto dom_backend = base::MakeUnique<devtools::AshDevToolsDOMAgent>(); |
805 auto css_backend = | 807 auto css_backend = |
806 base::MakeUnique<devtools::AshDevToolsCSSAgent>(dom_backend.get()); | 808 base::MakeUnique<devtools::AshDevToolsCSSAgent>(dom_backend.get()); |
807 auto devtools_client = base::MakeUnique<ui::devtools::UiDevToolsClient>( | 809 auto devtools_client = base::MakeUnique<ui::devtools::UiDevToolsClient>( |
808 "Ash", devtools_server_.get()); | 810 "Ash", devtools_server_.get()); |
809 devtools_client->AddAgent(std::move(dom_backend)); | 811 devtools_client->AddAgent(std::move(dom_backend)); |
810 devtools_client->AddAgent(std::move(css_backend)); | 812 devtools_client->AddAgent(std::move(css_backend)); |
811 devtools_server_->AttachClient(std::move(devtools_client)); | 813 devtools_server_->AttachClient(std::move(devtools_client)); |
812 } | 814 } |
813 | 815 |
814 if (is_mash) | 816 if (config == Config::MASH) |
815 app_list_delegate_impl_ = base::MakeUnique<AppListDelegateImpl>(); | 817 app_list_delegate_impl_ = base::MakeUnique<AppListDelegateImpl>(); |
816 | 818 |
817 // TODO(sky): move creation to ShellPort. | 819 // TODO(sky): move creation to ShellPort. |
818 if (!is_mash) | 820 if (config != Config::MASH) |
819 immersive_handler_factory_ = base::MakeUnique<ImmersiveHandlerFactoryAsh>(); | 821 immersive_handler_factory_ = base::MakeUnique<ImmersiveHandlerFactoryAsh>(); |
820 | 822 |
821 scoped_overview_animation_settings_factory_.reset( | 823 scoped_overview_animation_settings_factory_.reset( |
822 new ScopedOverviewAnimationSettingsFactoryAura); | 824 new ScopedOverviewAnimationSettingsFactoryAura); |
823 window_positioner_ = base::MakeUnique<WindowPositioner>(); | 825 window_positioner_ = base::MakeUnique<WindowPositioner>(); |
824 | 826 |
825 if (config == Config::CLASSIC) { | 827 if (config == Config::CLASSIC) { |
826 // TODO: needs to work in mus. http://crbug.com/705592. | 828 // TODO: needs to work in mus. http://crbug.com/705592. |
827 native_cursor_manager_ = new AshNativeCursorManager; | 829 native_cursor_manager_ = new AshNativeCursorManager; |
828 cursor_manager_.reset( | 830 cursor_manager_.reset( |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
904 // FocusController takes ownership of AshFocusRules. | 906 // FocusController takes ownership of AshFocusRules. |
905 focus_controller_ = | 907 focus_controller_ = |
906 base::MakeUnique<::wm::FocusController>(new wm::AshFocusRules()); | 908 base::MakeUnique<::wm::FocusController>(new wm::AshFocusRules()); |
907 focus_controller_->AddObserver(this); | 909 focus_controller_->AddObserver(this); |
908 | 910 |
909 screen_position_controller_.reset(new ScreenPositionController); | 911 screen_position_controller_.reset(new ScreenPositionController); |
910 | 912 |
911 shell_port_->CreatePrimaryHost(); | 913 shell_port_->CreatePrimaryHost(); |
912 root_window_for_new_windows_ = WmWindow::Get(GetPrimaryRootWindow()); | 914 root_window_for_new_windows_ = WmWindow::Get(GetPrimaryRootWindow()); |
913 | 915 |
914 if (!is_mash) { | 916 if (config != Config::MASH) { |
915 resolution_notification_controller_.reset( | 917 resolution_notification_controller_.reset( |
916 new ResolutionNotificationController); | 918 new ResolutionNotificationController); |
917 } | 919 } |
918 | 920 |
919 if (cursor_manager_) { | 921 if (cursor_manager_) { |
920 cursor_manager_->SetDisplay( | 922 cursor_manager_->SetDisplay( |
921 display::Screen::GetScreen()->GetPrimaryDisplay()); | 923 display::Screen::GetScreen()->GetPrimaryDisplay()); |
922 } | 924 } |
923 | 925 |
924 accelerator_controller_ = shell_port_->CreateAcceleratorController(); | 926 accelerator_controller_ = shell_port_->CreateAcceleratorController(); |
(...skipping 25 matching lines...) Expand all Loading... | |
950 std::unique_ptr<::wm::AcceleratorDelegate>(new AcceleratorDelegate), | 952 std::unique_ptr<::wm::AcceleratorDelegate>(new AcceleratorDelegate), |
951 accelerator_controller_->accelerator_history())); | 953 accelerator_controller_->accelerator_history())); |
952 AddPreTargetHandler(accelerator_filter_.get()); | 954 AddPreTargetHandler(accelerator_filter_.get()); |
953 | 955 |
954 event_transformation_handler_.reset(new EventTransformationHandler); | 956 event_transformation_handler_.reset(new EventTransformationHandler); |
955 AddPreTargetHandler(event_transformation_handler_.get()); | 957 AddPreTargetHandler(event_transformation_handler_.get()); |
956 | 958 |
957 toplevel_window_event_handler_ = | 959 toplevel_window_event_handler_ = |
958 base::MakeUnique<ToplevelWindowEventHandler>(); | 960 base::MakeUnique<ToplevelWindowEventHandler>(); |
959 | 961 |
960 if (!is_mash) { | 962 if (config != Config::MASH) { |
961 system_gesture_filter_.reset(new SystemGestureEventFilter); | 963 system_gesture_filter_.reset(new SystemGestureEventFilter); |
962 AddPreTargetHandler(system_gesture_filter_.get()); | 964 AddPreTargetHandler(system_gesture_filter_.get()); |
963 } | 965 } |
964 | 966 |
965 sticky_keys_controller_.reset(new StickyKeysController); | 967 sticky_keys_controller_.reset(new StickyKeysController); |
966 screen_pinning_controller_ = base::MakeUnique<ScreenPinningController>(); | 968 screen_pinning_controller_ = base::MakeUnique<ScreenPinningController>(); |
967 | 969 |
968 lock_state_controller_ = | 970 lock_state_controller_ = |
969 base::MakeUnique<LockStateController>(shutdown_controller_.get()); | 971 base::MakeUnique<LockStateController>(shutdown_controller_.get()); |
970 power_button_controller_.reset( | 972 power_button_controller_.reset( |
971 new PowerButtonController(lock_state_controller_.get())); | 973 new PowerButtonController(lock_state_controller_.get())); |
972 // Pass the initial display state to PowerButtonController. | 974 // Pass the initial display state to PowerButtonController. |
973 power_button_controller_->OnDisplayModeChanged( | 975 power_button_controller_->OnDisplayModeChanged( |
974 display_configurator_->cached_displays()); | 976 display_configurator_->cached_displays()); |
975 | 977 |
976 AddShellObserver(lock_state_controller_.get()); | 978 AddShellObserver(lock_state_controller_.get()); |
977 | 979 |
978 // The connector is unavailable in some tests. | 980 // The connector is unavailable in some tests. |
979 if (is_mash && shell_delegate_->GetShellConnector()) { | 981 if (config == Config::MASH && shell_delegate_->GetShellConnector()) { |
980 ui::mojom::UserActivityMonitorPtr user_activity_monitor; | 982 ui::mojom::UserActivityMonitorPtr user_activity_monitor; |
981 shell_delegate_->GetShellConnector()->BindInterface(ui::mojom::kServiceName, | 983 shell_delegate_->GetShellConnector()->BindInterface(ui::mojom::kServiceName, |
982 &user_activity_monitor); | 984 &user_activity_monitor); |
983 user_activity_forwarder_ = base::MakeUnique<aura::UserActivityForwarder>( | 985 user_activity_forwarder_ = base::MakeUnique<aura::UserActivityForwarder>( |
984 std::move(user_activity_monitor), user_activity_detector_.get()); | 986 std::move(user_activity_monitor), user_activity_detector_.get()); |
985 } | 987 } |
986 | 988 |
987 drag_drop_controller_.reset(new DragDropController); | 989 drag_drop_controller_.reset(new DragDropController); |
988 // |screenshot_controller_| needs to be created (and prepended as a | 990 // |screenshot_controller_| needs to be created (and prepended as a |
989 // pre-target handler) at this point, because |mouse_cursor_filter_| needs to | 991 // pre-target handler) at this point, because |mouse_cursor_filter_| needs to |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1033 SetSystemTrayDelegate( | 1035 SetSystemTrayDelegate( |
1034 base::WrapUnique(shell_delegate_->CreateSystemTrayDelegate())); | 1036 base::WrapUnique(shell_delegate_->CreateSystemTrayDelegate())); |
1035 | 1037 |
1036 // May trigger initialization of the Bluetooth adapter. | 1038 // May trigger initialization of the Bluetooth adapter. |
1037 tray_bluetooth_helper_->Initialize(); | 1039 tray_bluetooth_helper_->Initialize(); |
1038 | 1040 |
1039 // Create AshTouchTransformController before | 1041 // Create AshTouchTransformController before |
1040 // WindowTreeHostManager::InitDisplays() | 1042 // WindowTreeHostManager::InitDisplays() |
1041 // since AshTouchTransformController listens on | 1043 // since AshTouchTransformController listens on |
1042 // WindowTreeHostManager::Observer::OnDisplaysInitialized(). | 1044 // WindowTreeHostManager::Observer::OnDisplaysInitialized(). |
1043 if (!is_mash) { | 1045 if (config != Config::MASH) { |
1044 touch_transformer_controller_.reset(new AshTouchTransformController( | 1046 touch_transformer_controller_.reset(new AshTouchTransformController( |
1045 display_configurator_.get(), display_manager_.get())); | 1047 display_configurator_.get(), display_manager_.get())); |
1046 } | 1048 } |
1047 | 1049 |
1048 keyboard_ui_ = shell_port_->CreateKeyboardUI(); | 1050 keyboard_ui_ = shell_port_->CreateKeyboardUI(); |
1049 | 1051 |
1050 shell_port_->InitHosts(init_params); | 1052 shell_port_->InitHosts(init_params); |
1051 | 1053 |
1052 // Needs to be created after InitDisplays() since it may cause the virtual | 1054 // Needs to be created after InitDisplays() since it may cause the virtual |
1053 // keyboard to be deployed. | 1055 // keyboard to be deployed. |
1054 if (!is_mash) | 1056 if (config != Config::MASH) |
1055 virtual_keyboard_controller_.reset(new VirtualKeyboardController); | 1057 virtual_keyboard_controller_.reset(new VirtualKeyboardController); |
1056 | 1058 |
1057 audio_a11y_controller_.reset(new chromeos::AudioA11yController); | 1059 audio_a11y_controller_.reset(new chromeos::AudioA11yController); |
1058 | 1060 |
1059 // Initialize the wallpaper after the RootWindowController has been created, | 1061 // Initialize the wallpaper after the RootWindowController has been created, |
1060 // otherwise the widget will not paint when restoring after a browser crash. | 1062 // otherwise the widget will not paint when restoring after a browser crash. |
1061 // Also, initialize after display initialization to ensure correct sizing. | 1063 // Also, initialize after display initialization to ensure correct sizing. |
1062 wallpaper_delegate_->InitializeWallpaper(); | 1064 wallpaper_delegate_->InitializeWallpaper(); |
1063 | 1065 |
1064 if (cursor_manager_) { | 1066 if (cursor_manager_) { |
1065 if (initially_hide_cursor_) | 1067 if (initially_hide_cursor_) |
1066 cursor_manager_->HideCursor(); | 1068 cursor_manager_->HideCursor(); |
1067 cursor_manager_->SetCursor(ui::kCursorPointer); | 1069 cursor_manager_->SetCursor(ui::kCursorPointer); |
1068 } | 1070 } |
1069 | 1071 |
1070 power_event_observer_.reset(new PowerEventObserver()); | 1072 power_event_observer_.reset(new PowerEventObserver()); |
1071 user_activity_notifier_.reset( | 1073 user_activity_notifier_.reset( |
1072 new ui::UserActivityPowerManagerNotifier(user_activity_detector_.get())); | 1074 new ui::UserActivityPowerManagerNotifier(user_activity_detector_.get())); |
1073 video_activity_notifier_.reset( | 1075 video_activity_notifier_.reset( |
1074 new VideoActivityNotifier(video_detector_.get())); | 1076 new VideoActivityNotifier(video_detector_.get())); |
1075 bluetooth_notification_controller_.reset(new BluetoothNotificationController); | 1077 bluetooth_notification_controller_.reset(new BluetoothNotificationController); |
1076 if (!is_mash) { | 1078 if (config != Config::MASH) { |
1077 screen_orientation_controller_.reset(new ScreenOrientationController()); | 1079 screen_orientation_controller_.reset(new ScreenOrientationController()); |
1078 screen_layout_observer_.reset(new ScreenLayoutObserver()); | 1080 screen_layout_observer_.reset(new ScreenLayoutObserver()); |
1079 } | 1081 } |
1080 sms_observer_.reset(new SmsObserver()); | 1082 sms_observer_.reset(new SmsObserver()); |
1081 | 1083 |
1082 // The compositor thread and main message loop have to be running in | 1084 // The compositor thread and main message loop have to be running in |
1083 // order to create mirror window. Run it after the main message loop | 1085 // order to create mirror window. Run it after the main message loop |
1084 // is started. | 1086 // is started. |
1085 if (!is_mash) | 1087 if (config != Config::MASH) |
1086 display_manager_->CreateMirrorWindowAsyncIfAny(); | 1088 display_manager_->CreateMirrorWindowAsyncIfAny(); |
1087 | 1089 |
1088 for (auto& observer : shell_observers_) | 1090 for (auto& observer : shell_observers_) |
1089 observer.OnShellInitialized(); | 1091 observer.OnShellInitialized(); |
1090 | 1092 |
1091 if (!is_mash) | 1093 if (config != Config::MASH) |
1092 user_metrics_recorder_->OnShellInitialized(); | 1094 user_metrics_recorder_->OnShellInitialized(); |
1093 } | 1095 } |
1094 | 1096 |
1095 void Shell::InitKeyboard() { | 1097 void Shell::InitKeyboard() { |
1096 if (keyboard::IsKeyboardEnabled()) { | 1098 if (keyboard::IsKeyboardEnabled()) { |
1097 if (keyboard::KeyboardController::GetInstance()) { | 1099 if (keyboard::KeyboardController::GetInstance()) { |
1098 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 1100 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
1099 for (RootWindowControllerList::iterator iter = controllers.begin(); | 1101 for (RootWindowControllerList::iterator iter = controllers.begin(); |
1100 iter != controllers.end(); ++iter) { | 1102 iter != controllers.end(); ++iter) { |
1101 (*iter)->DeactivateKeyboard( | 1103 (*iter)->DeactivateKeyboard( |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1213 if (gained_active_wm) | 1215 if (gained_active_wm) |
1214 root_window_for_new_windows_ = gained_active_wm->GetRootWindow(); | 1216 root_window_for_new_windows_ = gained_active_wm->GetRootWindow(); |
1215 } | 1217 } |
1216 | 1218 |
1217 void Shell::SessionStateChanged(session_manager::SessionState state) { | 1219 void Shell::SessionStateChanged(session_manager::SessionState state) { |
1218 // Create the shelf when a session becomes active. It's safe to do this | 1220 // Create the shelf when a session becomes active. It's safe to do this |
1219 // multiple times (e.g. initial login vs. multiprofile add session). | 1221 // multiple times (e.g. initial login vs. multiprofile add session). |
1220 if (state == session_manager::SessionState::ACTIVE) { | 1222 if (state == session_manager::SessionState::ACTIVE) { |
1221 CreateShelfView(); | 1223 CreateShelfView(); |
1222 | 1224 |
1223 if (!shell_port_->IsRunningInMash()) { | 1225 if (GetAshConfig() != Config::MASH) { |
1224 // Recreate the keyboard after initial login and after multiprofile login. | 1226 // Recreate the keyboard after initial login and after multiprofile login. |
1225 CreateKeyboard(); | 1227 CreateKeyboard(); |
1226 } | 1228 } |
1227 } | 1229 } |
1228 } | 1230 } |
1229 | 1231 |
1230 void Shell::LoginStatusChanged(LoginStatus login_status) { | 1232 void Shell::LoginStatusChanged(LoginStatus login_status) { |
1231 UpdateAfterLoginStatusChange(login_status); | 1233 UpdateAfterLoginStatusChange(login_status); |
1232 | 1234 |
1233 // TODO(xiyuan): Update OnLoginStateChanged -> OnLoginStatusChanged. | 1235 // TODO(xiyuan): Update OnLoginStateChanged -> OnLoginStatusChanged. |
(...skipping 19 matching lines...) Expand all Loading... | |
1253 | 1255 |
1254 void Shell::OnPrefServiceInitialized( | 1256 void Shell::OnPrefServiceInitialized( |
1255 std::unique_ptr<::PrefService> pref_service) { | 1257 std::unique_ptr<::PrefService> pref_service) { |
1256 if (!instance_) | 1258 if (!instance_) |
1257 return; | 1259 return; |
1258 DCHECK(pref_service); | 1260 DCHECK(pref_service); |
1259 pref_service_ = std::move(pref_service); | 1261 pref_service_ = std::move(pref_service); |
1260 } | 1262 } |
1261 | 1263 |
1262 } // namespace ash | 1264 } // namespace ash |
OLD | NEW |