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 0cc82d7c520f441de1cc888b172bdb7e8fcb6b80..31911f391c149427e48e055739f6b0a8efcdd7a6 100644 |
--- a/chrome/browser/chromeos/login/user_manager_impl.cc |
+++ b/chrome/browser/chromeos/login/user_manager_impl.cc |
@@ -413,6 +413,7 @@ void UserManagerImpl::UserLoggedIn(const std::string& email) { |
void UserManagerImpl::DemoUserLoggedIn() { |
is_current_user_new_ = true; |
is_current_user_ephemeral_ = true; |
+ ephemeral_user_wallpaper_index_ = ash::GetDefaultWallpaperIndex(); |
logged_in_user_ = new User(kDemoUser, false); |
SetInitialUserImage(kDemoUser); |
NotifyOnLogin(); |
@@ -420,6 +421,7 @@ void UserManagerImpl::DemoUserLoggedIn() { |
void UserManagerImpl::GuestUserLoggedIn() { |
is_current_user_ephemeral_ = true; |
+ ephemeral_user_wallpaper_index_ = ash::GetGuestWallpaperIndex(); |
logged_in_user_ = new User(kGuestUser, true); |
NotifyOnLogin(); |
} |
@@ -427,6 +429,7 @@ void UserManagerImpl::GuestUserLoggedIn() { |
void UserManagerImpl::EphemeralUserLoggedIn(const std::string& email) { |
is_current_user_new_ = true; |
is_current_user_ephemeral_ = true; |
+ ephemeral_user_wallpaper_index_ = ash::GetDefaultWallpaperIndex(); |
logged_in_user_ = CreateUser(email); |
SetInitialUserImage(email); |
NotifyOnLogin(); |
@@ -910,10 +913,13 @@ void UserManagerImpl::SetInitialUserImage(const std::string& username) { |
int UserManagerImpl::GetUserWallpaperIndex() { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
- // If at login screen or logged in as a guest/incognito user, then use the |
- // randomly generated wallpaper. |
+ // If at login screen or logged in as a guest user, use the default guest |
+ // wallpaper. If logged in as other ephemeral uses (Demo/Stub/Normal user |
+ // with ephemeral policy enabled), use the index in memory. |
if (IsLoggedInAsGuest() || !IsUserLoggedIn()) |
Nikita (slow)
2012/03/26 15:31:58
if (!IsUserLoggedIn())
guest is handled below.
bshe
2012/03/26 16:12:10
It seems we want to always return the same index f
Nikita (slow)
2012/03/26 16:50:07
Ok, now I've checked that kGuestWallpaperIndex is
|
return ash::GetGuestWallpaperIndex(); |
+ if (IsCurrentUserEphemeral()) |
+ return ephemeral_user_wallpaper_index_; |
const chromeos::User& user = GetLoggedInUser(); |
std::string username = user.email(); |
@@ -932,11 +938,12 @@ int UserManagerImpl::GetUserWallpaperIndex() { |
void UserManagerImpl::SaveUserWallpaperIndex(int wallpaper_index) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
- // If at login screen or logged in as a guest/incognito user, then return. |
- // Guest/incognito user can not change wallpaper according to chromium-os |
- // issue 26900. |
- if (IsLoggedInAsGuest() || !IsUserLoggedIn()) |
+ // Ephemeral users can not save data to local state. We cache the index in |
+ // memory for them. |
+ if (IsCurrentUserEphemeral() || !IsUserLoggedIn()) { |
+ ephemeral_user_wallpaper_index_ = wallpaper_index; |
return; |
+ } |
const chromeos::User& user = GetLoggedInUser(); |
std::string username = user.email(); |