Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1444)

Unified Diff: ash/common/session/session_controller.cc

Issue 2734933004: ash: Use SessionController instead of SessionStateDelegate (Closed)
Patch Set: rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/common/session/session_controller.cc
diff --git a/ash/common/session/session_controller.cc b/ash/common/session/session_controller.cc
index 12a9cec3b659a199a4d56921e3e032266f8adaa2..27f130a13eab06a7c2ddc2cdfe43e6657439d38f 100644
--- a/ash/common/session/session_controller.cc
+++ b/ash/common/session/session_controller.cc
@@ -40,7 +40,7 @@ bool SessionController::IsActiveUserSessionStarted() const {
}
bool SessionController::CanLockScreen() const {
- return can_lock_;
+ return IsActiveUserSessionStarted() && can_lock_;
xiyuan 2017/03/17 07:08:15 Behavior change, caught by LockStateControllerTest
}
bool SessionController::IsScreenLocked() const {
@@ -55,6 +55,10 @@ bool SessionController::IsUserSessionBlocked() const {
return state_ != session_manager::SessionState::ACTIVE;
}
+bool SessionController::IsInSecondaryLoginScreen() const {
+ return state_ == session_manager::SessionState::LOGIN_SECONDARY;
+}
+
session_manager::SessionState SessionController::GetSessionState() const {
return state_;
}
@@ -64,6 +68,14 @@ const std::vector<mojom::UserSessionPtr>& SessionController::GetUserSessions()
return user_sessions_;
}
+const mojom::UserSession* SessionController::GetUserSession(
+ UserIndex index) const {
+ if (index < 0 || index >= static_cast<UserIndex>(user_sessions_.size()))
+ return nullptr;
+
+ return user_sessions_[index].get();
+}
+
void SessionController::LockScreen() {
if (client_)
client_->RequestLockScreen();
@@ -172,6 +184,15 @@ void SessionController::SetUserSessionOrder(
}
}
+void SessionController::ClearUserSessionsForTest() {
+ user_sessions_.clear();
+}
+
+void SessionController::LockScreenAndFlushForTest() {
+ LockScreen();
+ client_.FlushForTesting();
+}
+
void SessionController::SetSessionState(session_manager::SessionState state) {
if (state_ == state)
return;

Powered by Google App Engine
This is Rietveld 408576698