Chromium Code Reviews| 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 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1208 WmWindow* gained_active_wm = WmWindow::Get(gained_active); | 1208 WmWindow* gained_active_wm = WmWindow::Get(gained_active); |
| 1209 if (gained_active_wm) | 1209 if (gained_active_wm) |
| 1210 root_window_for_new_windows_ = gained_active_wm->GetRootWindow(); | 1210 root_window_for_new_windows_ = gained_active_wm->GetRootWindow(); |
| 1211 } | 1211 } |
| 1212 | 1212 |
| 1213 void Shell::OnSessionStateChanged(session_manager::SessionState state) { | 1213 void Shell::OnSessionStateChanged(session_manager::SessionState state) { |
| 1214 // Create the shelf when a session becomes active. It's safe to do this | 1214 // Create the shelf when a session becomes active. It's safe to do this |
| 1215 // multiple times (e.g. initial login vs. multiprofile add session). | 1215 // multiple times (e.g. initial login vs. multiprofile add session). |
| 1216 if (state == session_manager::SessionState::ACTIVE) { | 1216 if (state == session_manager::SessionState::ACTIVE) { |
| 1217 CreateShelfView(); | 1217 CreateShelfView(); |
| 1218 } | |
| 1218 | 1219 |
| 1220 // The keyboard is recreated on user profile change, so to refresh keyboard | |
| 1221 // extensions with the new profile and proper IME engine is called from them. | |
| 1222 // |LOGGED_IN_NOT_ACTIVE| is needed so that the virtual keyboard works on | |
| 1223 // supervised user creation. crbug.com/712873 | |
| 1224 // The previous state is checked to avoid needless |CreateKeyboard| call. | |
| 1225 if ((state == session_manager::SessionState::LOGGED_IN_NOT_ACTIVE || | |
| 1226 state == session_manager::SessionState::ACTIVE) && | |
| 1227 !(previous_state_ == | |
| 1228 session_manager::SessionState::LOGGED_IN_NOT_ACTIVE || | |
| 1229 previous_state_ == session_manager::SessionState::ACTIVE)) { | |
|
xiyuan
2017/05/12 17:30:03
How about using KeyboardController::GetInstance()
oka
2017/06/07 12:42:37
Updated.
| |
| 1219 if (GetAshConfig() != Config::MASH) { | 1230 if (GetAshConfig() != Config::MASH) { |
|
Alexander Alekseev
2017/05/12 04:05:21
Did you verify that multiprofile mode works with t
oka
2017/06/07 12:42:37
I manually confirmed keyboard works after multipro
| |
| 1220 // Recreate the keyboard after initial login and after multiprofile login. | |
| 1221 CreateKeyboard(); | 1231 CreateKeyboard(); |
| 1222 } | 1232 } |
| 1223 } | 1233 } |
| 1234 previous_state_ = state; | |
| 1224 } | 1235 } |
| 1225 | 1236 |
| 1226 void Shell::OnLoginStatusChanged(LoginStatus login_status) { | 1237 void Shell::OnLoginStatusChanged(LoginStatus login_status) { |
| 1227 UpdateAfterLoginStatusChange(login_status); | 1238 UpdateAfterLoginStatusChange(login_status); |
| 1228 } | 1239 } |
| 1229 | 1240 |
| 1230 void Shell::OnLockStateChanged(bool locked) { | 1241 void Shell::OnLockStateChanged(bool locked) { |
| 1231 #ifndef NDEBUG | 1242 #ifndef NDEBUG |
| 1232 // Make sure that there is no system modal in Lock layer when unlocked. | 1243 // Make sure that there is no system modal in Lock layer when unlocked. |
| 1233 if (!locked) { | 1244 if (!locked) { |
| 1234 aura::Window::Windows containers = wm::GetContainersFromAllRootWindows( | 1245 aura::Window::Windows containers = wm::GetContainersFromAllRootWindows( |
| 1235 kShellWindowId_LockSystemModalContainer, GetPrimaryRootWindow()); | 1246 kShellWindowId_LockSystemModalContainer, GetPrimaryRootWindow()); |
| 1236 for (aura::Window* container : containers) | 1247 for (aura::Window* container : containers) |
| 1237 DCHECK(container->children().empty()); | 1248 DCHECK(container->children().empty()); |
| 1238 } | 1249 } |
| 1239 #endif | 1250 #endif |
| 1240 } | 1251 } |
| 1241 | 1252 |
| 1242 void Shell::OnPrefServiceInitialized( | 1253 void Shell::OnPrefServiceInitialized( |
| 1243 std::unique_ptr<::PrefService> pref_service) { | 1254 std::unique_ptr<::PrefService> pref_service) { |
| 1244 if (!instance_) | 1255 if (!instance_) |
| 1245 return; | 1256 return; |
| 1246 // |pref_service_| is null if can't connect to Chrome (as happens when | 1257 // |pref_service_| is null if can't connect to Chrome (as happens when |
| 1247 // running mash outside of chrome --mash and chrome isn't built). | 1258 // running mash outside of chrome --mash and chrome isn't built). |
| 1248 pref_service_ = std::move(pref_service); | 1259 pref_service_ = std::move(pref_service); |
| 1249 } | 1260 } |
| 1250 | 1261 |
| 1251 } // namespace ash | 1262 } // namespace ash |
| OLD | NEW |