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 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "ash/session/session_observer.h" | 10 #include "ash/session/session_observer.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 75 | 75 |
| 76 bool SessionController::IsScreenLocked() const { | 76 bool SessionController::IsScreenLocked() const { |
| 77 return state_ == SessionState::LOCKED; | 77 return state_ == SessionState::LOCKED; |
| 78 } | 78 } |
| 79 | 79 |
| 80 bool SessionController::ShouldLockScreenAutomatically() const { | 80 bool SessionController::ShouldLockScreenAutomatically() const { |
| 81 return should_lock_screen_automatically_; | 81 return should_lock_screen_automatically_; |
| 82 } | 82 } |
| 83 | 83 |
| 84 bool SessionController::IsUserSessionBlocked() const { | 84 bool SessionController::IsUserSessionBlocked() const { |
| 85 // User sessions are blocked when session state is not ACTIVE, except that | 85 // User sessions are blocked when session state is not ACTIVE, with two |
| 86 // LOCKED state with a running unlocking animation. This is made an exception | 86 // exceptions: |
| 87 // because the unlocking animation hides lock container at the end. During the | 87 // - LOGGED_IN_NOT_ACTIVE state. This is needed so that browser windows |
| 88 // unlock animation, IsUserSessionBlocked needs to return unblocked so that | 88 // created by session restore (or a default new browser window) is properly |
| 89 // user windows are deemed activatable and ash correctly restore the active | 89 // activated before session state changes to ACTIVE. |
|
James Cook
2017/05/24 20:08:13
Aside: Didn't we have some trouble about 6 months
xiyuan
2017/05/24 20:37:22
I believe this is the relevant discussion in the C
James Cook
2017/05/24 20:52:35
Ah, OK. Nothing to do, then.
| |
| 90 // window before locking. | 90 // - LOCKED state with a running unlocking animation. This is needed because |
| 91 // the unlocking animation hides lock container at the end. During the | |
| 92 // unlock animation, IsUserSessionBlocked needs to return unblocked so that | |
| 93 // user windows are deemed activatable and ash correctly restore the active | |
| 94 // window before locking. | |
| 91 return state_ != SessionState::ACTIVE && | 95 return state_ != SessionState::ACTIVE && |
| 96 state_ != SessionState::LOGGED_IN_NOT_ACTIVE && | |
| 92 !(state_ == SessionState::LOCKED && is_unlocking_); | 97 !(state_ == SessionState::LOCKED && is_unlocking_); |
| 93 } | 98 } |
| 94 | 99 |
| 95 bool SessionController::IsInSecondaryLoginScreen() const { | 100 bool SessionController::IsInSecondaryLoginScreen() const { |
| 96 return state_ == SessionState::LOGIN_SECONDARY; | 101 return state_ == SessionState::LOGIN_SECONDARY; |
| 97 } | 102 } |
| 98 | 103 |
| 99 SessionState SessionController::GetSessionState() const { | 104 SessionState SessionController::GetSessionState() const { |
| 100 return state_; | 105 return state_; |
| 101 } | 106 } |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 382 for (auto& observer : observers_) | 387 for (auto& observer : observers_) |
| 383 observer.OnLoginStatusChanged(login_status_); | 388 observer.OnLoginStatusChanged(login_status_); |
| 384 } | 389 } |
| 385 | 390 |
| 386 void SessionController::OnLockAnimationFinished() { | 391 void SessionController::OnLockAnimationFinished() { |
| 387 if (!start_lock_callback_.is_null()) | 392 if (!start_lock_callback_.is_null()) |
| 388 std::move(start_lock_callback_).Run(true /* locked */); | 393 std::move(start_lock_callback_).Run(true /* locked */); |
| 389 } | 394 } |
| 390 | 395 |
| 391 } // namespace ash | 396 } // namespace ash |
| OLD | NEW |