Chromium Code Reviews| Index: chrome/browser/chromeos/login/user_manager_impl.cc |
| diff --git a/chrome/browser/chromeos/login/user_manager_impl.cc b/chrome/browser/chromeos/login/user_manager_impl.cc |
| index 546e47b72172190eed504978d71be710ea357d0a..3e6ebb757c6b72b76b9d58ac11c7f0270f898fe7 100644 |
| --- a/chrome/browser/chromeos/login/user_manager_impl.cc |
| +++ b/chrome/browser/chromeos/login/user_manager_impl.cc |
| @@ -42,6 +42,7 @@ |
| #include "chrome/common/chrome_switches.h" |
| #include "chrome/common/pref_names.h" |
| #include "chromeos/cryptohome/async_method_caller.h" |
| +#include "chromeos/login/login_state.h" |
| #include "content/public/browser/browser_thread.h" |
| #include "content/public/browser/notification_service.h" |
| #include "google_apis/gaia/gaia_auth_util.h" |
| @@ -205,6 +206,7 @@ UserManagerImpl::UserManagerImpl() |
| registrar_.Add(this, chrome::NOTIFICATION_PROFILE_ADDED, |
| content::NotificationService::AllSources()); |
| RetrieveTrustedDevicePolicies(); |
| + UpdateLoginState(); |
| } |
| UserManagerImpl::~UserManagerImpl() { |
| @@ -412,6 +414,7 @@ void UserManagerImpl::RegularUserLoggedInAsEphemeral(const std::string& email) { |
| void UserManagerImpl::SessionStarted() { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| session_started_ = true; |
| + UpdateLoginState(); |
| content::NotificationService::current()->Notify( |
| chrome::NOTIFICATION_SESSION_STARTED, |
| content::NotificationService::AllSources(), |
| @@ -713,6 +716,7 @@ void UserManagerImpl::SetCurrentUserIsOwner(bool is_current_user_owner) { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| base::AutoLock lk(is_current_user_owner_lock_); |
| is_current_user_owner_ = is_current_user_owner; |
| + UpdateLoginState(); |
| } |
| bool UserManagerImpl::IsCurrentUserNew() const { |
| @@ -986,6 +990,7 @@ const User* UserManagerImpl::FindUserInList(const std::string& email) const { |
| void UserManagerImpl::NotifyOnLogin() { |
| CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| + UpdateLoginState(); |
| content::NotificationService::current()->Notify( |
| chrome::NOTIFICATION_LOGIN_USER_CHANGED, |
| content::Source<UserManager>(this), |
| @@ -1299,4 +1304,21 @@ void UserManagerImpl::NotifyMergeSessionStateChanged() { |
| MergeSessionStateChanged(merge_session_state_)); |
| } |
| +void UserManagerImpl::UpdateLoginState() { |
| + LoginState::State login_state; |
| + if (!IsSessionStarted()) |
| + login_state = LoginState::LOGGED_IN_NONE; |
| + else if (IsCurrentUserOwner()) |
| + login_state = LoginState::LOGGED_IN_OWNER; |
| + else if (IsLoggedInAsGuest()) |
| + login_state = LoginState::LOGGED_IN_GUEST; |
| + else if (IsLoggedInAsDemoUser()) |
| + login_state = LoginState::LOGGED_IN_KIOSK_APP; |
|
bartfab (slow)
2013/04/03 08:21:36
Ugh. Does single-app mode really reuse the retail
stevenjb
2013/04/03 17:21:42
I'm not sure I understand the question, but I copi
Nikita (slow)
2013/04/03 17:48:13
I think these two should be separated.
DemoUser =
|
| + else if (IsLoggedInAsPublicAccount()) |
| + login_state = LoginState::LOGGED_IN_PUBLIC; |
| + else |
| + login_state = LoginState::LOGGED_IN_USER; |
| + LoginState::Get()->SetLoginState(login_state); |
| +} |
| + |
| } // namespace chromeos |