| 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_state_observer.h" | 9 #include "ash/session/session_state_observer.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 bool SessionController::IsScreenLocked() const { | 72 bool SessionController::IsScreenLocked() const { |
| 73 return state_ == SessionState::LOCKED; | 73 return state_ == SessionState::LOCKED; |
| 74 } | 74 } |
| 75 | 75 |
| 76 bool SessionController::ShouldLockScreenAutomatically() const { | 76 bool SessionController::ShouldLockScreenAutomatically() const { |
| 77 return should_lock_screen_automatically_; | 77 return should_lock_screen_automatically_; |
| 78 } | 78 } |
| 79 | 79 |
| 80 bool SessionController::IsUserSessionBlocked() const { | 80 bool SessionController::IsUserSessionBlocked() const { |
| 81 // User sessions are blocked when session state is not ACTIVE, except that | 81 // User sessions are blocked when session state is not ACTIVE, with two |
| 82 // LOCKED state with a running unlocking animation. This is made an exception | 82 // exceptions: |
| 83 // because the unlocking animation hides lock container at the end. During the | 83 // - LOGGED_IN_NOT_ACTIVE state. This is needed so that browser windows |
| 84 // unlock animation, IsUserSessionBlocked needs to return unblocked so that | 84 // created by session restore (or a default new browser window) are properly |
| 85 // user windows are deemed activatable and ash correctly restore the active | 85 // activated before session state changes to ACTIVE. |
| 86 // window before locking. | 86 // - LOCKED state with a running unlocking animation. This is needed because |
| 87 // the unlocking animation hides the lock container at the end. During the |
| 88 // unlock animation, IsUserSessionBlocked needs to return unblocked so that |
| 89 // user windows are deemed activatable and ash correctly restores the active |
| 90 // window before locking. |
| 87 return state_ != SessionState::ACTIVE && | 91 return state_ != SessionState::ACTIVE && |
| 92 state_ != SessionState::LOGGED_IN_NOT_ACTIVE && |
| 88 !(state_ == SessionState::LOCKED && is_unlocking_); | 93 !(state_ == SessionState::LOCKED && is_unlocking_); |
| 89 } | 94 } |
| 90 | 95 |
| 91 bool SessionController::IsInSecondaryLoginScreen() const { | 96 bool SessionController::IsInSecondaryLoginScreen() const { |
| 92 return state_ == SessionState::LOGIN_SECONDARY; | 97 return state_ == SessionState::LOGIN_SECONDARY; |
| 93 } | 98 } |
| 94 | 99 |
| 95 SessionState SessionController::GetSessionState() const { | 100 SessionState SessionController::GetSessionState() const { |
| 96 return state_; | 101 return state_; |
| 97 } | 102 } |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 const LoginStatus new_login_status = CalculateLoginStatus(); | 314 const LoginStatus new_login_status = CalculateLoginStatus(); |
| 310 if (new_login_status == login_status_) | 315 if (new_login_status == login_status_) |
| 311 return; | 316 return; |
| 312 | 317 |
| 313 login_status_ = new_login_status; | 318 login_status_ = new_login_status; |
| 314 for (auto& observer : observers_) | 319 for (auto& observer : observers_) |
| 315 observer.LoginStatusChanged(login_status_); | 320 observer.LoginStatusChanged(login_status_); |
| 316 } | 321 } |
| 317 | 322 |
| 318 } // namespace ash | 323 } // namespace ash |
| OLD | NEW |