Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/session/session_controller.h" | 5 #include "ash/session/session_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/session/session_observer.h" | 9 #include "ash/session/session_observer.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 203 if (user_sessions_[0]->session_id != active_session_id_) { | 203 if (user_sessions_[0]->session_id != active_session_id_) { |
| 204 active_session_id_ = user_sessions_[0]->session_id; | 204 active_session_id_ = user_sessions_[0]->session_id; |
| 205 | 205 |
| 206 for (auto& observer : observers_) | 206 for (auto& observer : observers_) |
| 207 observer.OnActiveUserSessionChanged(user_sessions_[0]->account_id); | 207 observer.OnActiveUserSessionChanged(user_sessions_[0]->account_id); |
| 208 | 208 |
| 209 UpdateLoginStatus(); | 209 UpdateLoginStatus(); |
| 210 } | 210 } |
| 211 } | 211 } |
| 212 | 212 |
| 213 void SessionController::RunLockAnimation( | |
| 214 const RunLockAnimationCallback& callback) { | |
| 215 LockStateController* const lock_state_controller = | |
| 216 Shell::Get()->lock_state_controller(); | |
| 217 | |
| 218 lock_state_controller->SetLockScreenDisplayedCallback(callback); | |
| 219 lock_state_controller->OnStartingLock(); | |
| 220 } | |
| 221 | |
| 213 void SessionController::RunUnlockAnimation( | 222 void SessionController::RunUnlockAnimation( |
| 214 const RunUnlockAnimationCallback& callback) { | 223 const RunUnlockAnimationCallback& callback) { |
| 215 is_unlocking_ = true; | 224 is_unlocking_ = true; |
| 216 | 225 |
| 217 // Shell could have no instance in tests. | 226 Shell::Get()->lock_state_controller()->OnLockScreenHide(callback); |
|
James Cook
2017/04/19 23:13:12
Thanks for cleaning this up.
xiyuan
2017/04/20 18:23:59
I have to put it back. SessionControllerTest deriv
| |
| 218 if (Shell::HasInstance()) | |
| 219 Shell::Get()->lock_state_controller()->OnLockScreenHide(callback); | |
| 220 } | 227 } |
| 221 | 228 |
| 222 void SessionController::NotifyChromeTerminating() { | 229 void SessionController::NotifyChromeTerminating() { |
| 223 for (auto& observer : observers_) | 230 for (auto& observer : observers_) |
| 224 observer.OnChromeTerminating(); | 231 observer.OnChromeTerminating(); |
| 225 } | 232 } |
| 226 | 233 |
| 227 void SessionController::ClearUserSessionsForTest() { | 234 void SessionController::ClearUserSessionsForTest() { |
| 228 user_sessions_.clear(); | 235 user_sessions_.clear(); |
| 229 } | 236 } |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 329 const LoginStatus new_login_status = CalculateLoginStatus(); | 336 const LoginStatus new_login_status = CalculateLoginStatus(); |
| 330 if (new_login_status == login_status_) | 337 if (new_login_status == login_status_) |
| 331 return; | 338 return; |
| 332 | 339 |
| 333 login_status_ = new_login_status; | 340 login_status_ = new_login_status; |
| 334 for (auto& observer : observers_) | 341 for (auto& observer : observers_) |
| 335 observer.OnLoginStatusChanged(login_status_); | 342 observer.OnLoginStatusChanged(login_status_); |
| 336 } | 343 } |
| 337 | 344 |
| 338 } // namespace ash | 345 } // namespace ash |
| OLD | NEW |