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

Unified Diff: chrome/browser/chromeos/login/user_manager_impl.cc

Issue 9580023: Enable user change background image in settings page in Aura build. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fix a debug build error associated with color mode switch Created 8 years, 9 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/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 f12e0db8f6fe451570c1422cf726c24c9b2ba245..196e515ffdb488348cc5b9b37e73f2c4497a2f4f 100644
--- a/chrome/browser/chromeos/login/user_manager_impl.cc
+++ b/chrome/browser/chromeos/login/user_manager_impl.cc
@@ -6,6 +6,7 @@
#include <vector>
+#include "ash/desktop_background/desktop_background_resources.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/compiler_specific.h"
@@ -438,6 +439,10 @@ void UserManagerImpl::RemoveUserFromList(const std::string& email) {
user_to_remove = it;
}
+ DictionaryPrefUpdate prefs_wallpapers_update(prefs,
+ UserManager::kUserWallpapers);
+ prefs_wallpapers_update->RemoveWithoutPathExpansion(email, NULL);
+
DictionaryPrefUpdate prefs_images_update(prefs, UserManager::kUserImages);
std::string image_path_string;
prefs_images_update->GetStringWithoutPathExpansion(email, &image_path_string);
@@ -837,6 +842,33 @@ void UserManagerImpl::SetInitialUserImage(const std::string& username) {
SaveUserDefaultImageIndex(username, image_id);
}
+int UserManagerImpl::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(UserManager::kUserWallpapers);
+ int index = ash::GetPresetWallpaperIndex();
+ user_wallpapers->GetIntegerWithoutPathExpansion(username,
+ &index);
+ return index;
+}
+
+void UserManagerImpl::SaveWallpaperDefaultIndex(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,
+ UserManager::kUserWallpapers);
+ wallpapers_update->SetWithoutPathExpansion(username,
+ new base::FundamentalValue(wallpaper_index));
+ content::NotificationService::current()->Notify(
+ chrome::NOTIFICATION_DESKTOP_BACKGROUND_CHANGED,
Ben Goodger (Google) 2012/03/09 23:20:17 can you not use notifications for this at all... r
bshe 2012/03/12 00:14:25 Done.
+ content::Source<UserManagerImpl>(this),
+ content::Details<int>(&wallpaper_index));
+}
+
void UserManagerImpl::SetUserImage(const std::string& username,
int image_index,
const SkBitmap& image) {

Powered by Google App Engine
This is Rietveld 408576698