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

Unified Diff: chrome/browser/ui/ash/session_state_delegate_chromeos.cc

Issue 2416253004: ash: Use session_manager::SessionState (Closed)
Patch Set: add comment about session state in SessionStaetDelegateChromeos Created 4 years, 2 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: chrome/browser/ui/ash/session_state_delegate_chromeos.cc
diff --git a/chrome/browser/ui/ash/session_state_delegate_chromeos.cc b/chrome/browser/ui/ash/session_state_delegate_chromeos.cc
index 686996a3758047317a222a2fca01b4dcc0279039..19d7a3b89ebe0da1b3abae25a958c6c46b1e481b 100644
--- a/chrome/browser/ui/ash/session_state_delegate_chromeos.cc
+++ b/chrome/browser/ui/ash/session_state_delegate_chromeos.cc
@@ -34,15 +34,23 @@
#include "ui/gfx/image/image_skia.h"
SessionStateDelegateChromeos::SessionStateDelegateChromeos()
- : session_state_(SESSION_STATE_LOGIN_PRIMARY) {
+ : session_state_(session_manager::SessionState::LOGIN_PRIMARY) {
user_manager::UserManager::Get()->AddSessionStateObserver(this);
chromeos::UserAddingScreen::Get()->AddObserver(this);
// LoginState is not initialized in unit_tests.
if (chromeos::LoginState::IsInitialized()) {
chromeos::LoginState::Get()->AddObserver(this);
- SetSessionState(chromeos::LoginState::Get()->IsUserLoggedIn() ?
- SESSION_STATE_ACTIVE : SESSION_STATE_LOGIN_PRIMARY, true);
+ // Note that the session state is only set to ACTIVE or LOGIN_PRIMARY
+ // instead of using SessionManager::Get()->session_state(). This is
+ // an intermediate state of replacing SessionStateDelegate with
+ // mojo interfaces. The replacement mojo interface would reflect
+ // real session state in SessionManager and have getters to translate
+ // them in a sensible way to ash code.
+ SetSessionState(chromeos::LoginState::Get()->IsUserLoggedIn()
+ ? session_manager::SessionState::ACTIVE
+ : session_manager::SessionState::LOGIN_PRIMARY,
+ true);
}
}
@@ -133,8 +141,8 @@ bool SessionStateDelegateChromeos::IsUserSessionBlocked() const {
chromeos::UserAddingScreen::Get()->IsRunning();
}
-ash::SessionStateDelegate::SessionState
-SessionStateDelegateChromeos::GetSessionState() const {
+session_manager::SessionState SessionStateDelegateChromeos::GetSessionState()
+ const {
return session_state_;
}
@@ -231,8 +239,10 @@ void SessionStateDelegateChromeos::RemoveSessionStateObserver(
}
void SessionStateDelegateChromeos::LoggedInStateChanged() {
- SetSessionState(chromeos::LoginState::Get()->IsUserLoggedIn() ?
- SESSION_STATE_ACTIVE : SESSION_STATE_LOGIN_PRIMARY, false);
+ SetSessionState(chromeos::LoginState::Get()->IsUserLoggedIn()
+ ? session_manager::SessionState::ACTIVE
+ : session_manager::SessionState::LOGIN_PRIMARY,
+ false);
}
void SessionStateDelegateChromeos::ActiveUserChanged(
@@ -248,15 +258,16 @@ void SessionStateDelegateChromeos::UserAddedToSession(
}
void SessionStateDelegateChromeos::OnUserAddingStarted() {
- SetSessionState(SESSION_STATE_LOGIN_SECONDARY, false);
+ SetSessionState(session_manager::SessionState::LOGIN_SECONDARY, false);
}
void SessionStateDelegateChromeos::OnUserAddingFinished() {
- SetSessionState(SESSION_STATE_ACTIVE, false);
+ SetSessionState(session_manager::SessionState::ACTIVE, false);
}
-void SessionStateDelegateChromeos::SetSessionState(SessionState new_state,
- bool force) {
+void SessionStateDelegateChromeos::SetSessionState(
+ session_manager::SessionState new_state,
+ bool force) {
if (session_state_ == new_state && !force)
return;

Powered by Google App Engine
This is Rietveld 408576698