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

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

Issue 9703031: Retry landing "Enable users change desktop background image from settings page in Chromeos Aura bui… (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Merge to trunk 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 88a4c763102b8639b8e306545c4514d15d3f9de0..018a7c9de9a403a16698c603ae6dce20f973ee79 100644
--- a/chrome/browser/chromeos/login/user_manager_impl.cc
+++ b/chrome/browser/chromeos/login/user_manager_impl.cc
@@ -6,6 +6,9 @@
#include <vector>
+#include "ash/shell.h"
+#include "ash/desktop_background/desktop_background_controller.h"
+#include "ash/desktop_background/desktop_background_resources.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/compiler_specific.h"
@@ -889,6 +892,31 @@ 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::GetDefaultWallpaperIndex();
+ 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));
+ ash::Shell::GetInstance()->desktop_background_controller()->
+ OnDesktopBackgroundChanged(wallpaper_index);
+}
+
void UserManagerImpl::SetUserImage(const std::string& username,
int image_index,
const SkBitmap& image) {
@@ -1145,6 +1173,10 @@ void UserManagerImpl::RemoveUserFromListInternal(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);
« no previous file with comments | « chrome/browser/chromeos/login/user_manager_impl.h ('k') | chrome/browser/resources/options2/browser_options.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698