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 a5800a51771b635d33e3d4b982e0c2b4a06f7acd..0cc82d7c520f441de1cc888b172bdb7e8fcb6b80 100644 |
--- a/chrome/browser/chromeos/login/user_manager_impl.cc |
+++ b/chrome/browser/chromeos/login/user_manager_impl.cc |
@@ -907,29 +907,46 @@ void UserManagerImpl::SetInitialUserImage(const std::string& username) { |
SaveUserDefaultImageIndex(username, image_id); |
} |
-int UserManagerImpl::GetUserWallpaper(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 (IsLoggedInAsGuest() || !IsUserLoggedIn()) |
Nikita (slow)
2012/03/25 21:24:08
+ IsCurrentUserEphemeral()
In fact you should rem
|
+ return ash::GetGuestWallpaperIndex(); |
+ |
+ const chromeos::User& user = GetLoggedInUser(); |
+ std::string username = user.email(); |
+ DCHECK(!username.empty()); |
+ |
PrefService* local_state = g_browser_process->local_state(); |
const DictionaryValue* user_wallpapers = |
local_state->GetDictionary(UserManager::kUserWallpapers); |
int index = ash::GetDefaultWallpaperIndex(); |
- user_wallpapers->GetIntegerWithoutPathExpansion(username, |
- &index); |
+ if (!user_wallpapers->GetIntegerWithoutPathExpansion(username, &index)) |
+ SaveUserWallpaperIndex(index); |
+ |
+ DCHECK(index >=0 && index < ash::GetWallpaperCount()); |
return index; |
} |
-void UserManagerImpl::SaveWallpaperDefaultIndex(const std::string& username, |
- int wallpaper_index) { |
+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()) |
Nikita (slow)
2012/03/25 21:24:08
Change IsLoggedInAsGuest() to IsCurrentUserEphemer
|
+ return; |
+ |
+ const chromeos::User& user = GetLoggedInUser(); |
+ std::string username = user.email(); |
+ DCHECK(!username.empty()); |
PrefService* local_state = g_browser_process->local_state(); |
DictionaryPrefUpdate wallpapers_update(local_state, |
UserManager::kUserWallpapers); |
wallpapers_update->SetWithoutPathExpansion(username, |
new base::FundamentalValue(wallpaper_index)); |
- ash::Shell::GetInstance()->desktop_background_controller()-> |
- OnDesktopBackgroundChanged(); |
} |
void UserManagerImpl::SetUserImage(const std::string& username, |