Index: chrome/browser/chromeos/login/user_manager.cc |
diff --git a/chrome/browser/chromeos/login/user_manager.cc b/chrome/browser/chromeos/login/user_manager.cc |
index 3b56995820865b357fa56d6669ff451387731f35..efe0c7b09fe9f0bd9e090d22c5926a0f691deac6 100644 |
--- a/chrome/browser/chromeos/login/user_manager.cc |
+++ b/chrome/browser/chromeos/login/user_manager.cc |
@@ -67,6 +67,8 @@ namespace { |
// A vector pref of the users who have logged into the device. |
const char kLoggedInUsers[] = "LoggedInUsers"; |
+// A dictionary that maps usernames to file paths to their wallpapers. |
+const char kUserWallpapers[] = "UserWallpapers"; |
// A dictionary that maps usernames to file paths to their images. |
const char kUserImages[] = "UserImages"; |
// A dictionary that maps usernames to the displayed (non-canonical) emails. |
@@ -74,6 +76,9 @@ const char kUserDisplayEmail[] = "UserDisplayEmail"; |
// A dictionary that maps usernames to OAuth token presence flag. |
const char kUserOAuthTokenStatus[] = "OAuthTokenStatus"; |
+// The default wallpaper index. |
+const int kDefaultWallpaperIndex = 0; |
+ |
// Incognito user is represented by an empty string (since some code already |
// depends on that and it's hard to figure out what). |
const char kGuestUser[] = ""; |
@@ -303,6 +308,8 @@ UserManager* UserManager::Get() { |
// static |
void UserManager::RegisterPrefs(PrefService* local_state) { |
local_state->RegisterListPref(kLoggedInUsers, PrefService::UNSYNCABLE_PREF); |
+ local_state->RegisterDictionaryPref(kUserWallpapers, |
+ PrefService::UNSYNCABLE_PREF); |
local_state->RegisterDictionaryPref(kUserImages, |
PrefService::UNSYNCABLE_PREF); |
local_state->RegisterDictionaryPref(kUserOAuthTokenStatus, |
@@ -443,6 +450,9 @@ void UserManager::RemoveUserFromList(const std::string& email) { |
user_to_remove = it; |
} |
+ DictionaryPrefUpdate prefs_wallpapers_update(prefs, kUserWallpapers); |
+ prefs_wallpapers_update->RemoveWithoutPathExpansion(email, NULL); |
+ |
DictionaryPrefUpdate prefs_images_update(prefs, kUserImages); |
std::string image_path_string; |
prefs_images_update->GetStringWithoutPathExpansion(email, &image_path_string); |
@@ -839,6 +849,28 @@ void UserManager::SetInitialUserImage(const std::string& username) { |
SaveUserDefaultImageIndex(username, image_id); |
} |
+int UserManager::GetUserWallpaper(const std::string& username) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ |
+ PrefService* local_state = g_browser_process->local_state(); |
+ const DictionaryValue* user_wallpapers = |
+ local_state->GetDictionary(kUserWallpapers); |
+ int index = kDefaultWallpaperIndex; |
+ user_wallpapers->GetIntegerWithoutPathExpansion(username, |
+ &index); |
+ return index; |
+} |
+ |
+void UserManager::SaveWallpaperToLocalState(const std::string& username, |
+ int wallpaper_index) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ |
+ PrefService* local_state = g_browser_process->local_state(); |
+ DictionaryPrefUpdate wallpapers_update(local_state, kUserWallpapers); |
+ wallpapers_update->SetWithoutPathExpansion(username, |
+ new base::FundamentalValue(wallpaper_index)); |
+} |
+ |
void UserManager::SetUserImage(const std::string& username, |
int image_index, |
const SkBitmap& image) { |