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

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

Issue 10527006: Use default wallpaper when the logged in user didn't have saved wallpaper in LocalState (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 a5df44fcb9ef512bcd6d00c1f44e42ad34c7b7fd..ee4aaa7f16693a7cb3ef50ed89433037edc95731 100644
--- a/chrome/browser/chromeos/login/user_manager_impl.cc
+++ b/chrome/browser/chromeos/login/user_manager_impl.cc
@@ -939,19 +939,31 @@ void UserManagerImpl::MigrateWallpaperData() {
const DictionaryValue* user_wallpapers =
local_state->GetDictionary(kUserWallpapers);
int index;
- if (user_wallpapers) {
- const UserList& users = GetUsers();
- for (UserList::const_iterator it = users.begin();
- it != users.end();
- ++it) {
- std::string username = (*it)->email();
- if (user_wallpapers->GetIntegerWithoutPathExpansion((username),
- &index)) {
- DictionaryPrefUpdate prefs_wallpapers_update(local_state,
- kUserWallpapers);
- prefs_wallpapers_update->RemoveWithoutPathExpansion(username, NULL);
- SaveUserWallpaperProperties(username, User::DEFAULT, index);
- }
+ const UserList& users = GetUsers();
+ for (UserList::const_iterator it = users.begin();
+ it != users.end();
+ ++it) {
+ std::string username = (*it)->email();
+ if (user_wallpapers->GetIntegerWithoutPathExpansion((username),
+ &index)) {
+ DictionaryPrefUpdate prefs_wallpapers_update(local_state,
+ kUserWallpapers);
+ prefs_wallpapers_update->RemoveWithoutPathExpansion(username, NULL);
+ SaveUserWallpaperProperties(username, User::DEFAULT, index);
+ } else {
+ // Before M20, wallpaper index is not saved into LocalState unless user
+ // specifically sets a wallpaper. After M20, the default wallpaper index
+ // is saved to LocalState as soon as a new user login. When migrating
+ // wallpaper index from M20 to M21, we only migrate data that is in
+ // LocalState. This cause a problem when users login on a M20 device and
+ // then update the device to M21. The default wallpaper index failed to
+ // migrate because it was not saved into LocalState. Then we assume that
+ // all users have index saved in LocalState in M21. This is not true and
+ // it results an empty wallpaper for those users as described in
+ // cr/130685. So here we use default wallpaper for users that exist in
+ // user list but does not have an index saved in LocalState.
+ SaveUserWallpaperProperties(username, User::DEFAULT,
+ ash::GetDefaultWallpaperIndex());
}
}
}
@@ -1027,17 +1039,15 @@ void UserManagerImpl::GetUserWallpaperProperties(const std::string& username,
if (!username.empty()) {
const DictionaryValue* user_wallpapers = g_browser_process->local_state()->
GetDictionary(UserManager::kUserWallpapersProperties);
- if (user_wallpapers) {
Nikita (slow) 2012/06/05 08:07:17 Why this check is removed? DCHECK(user_wallpapers)
bshe 2012/06/08 15:22:52 It seem this check is always true if we register t
- base::DictionaryValue* wallpaper_properties;
- if (user_wallpapers->GetDictionaryWithoutPathExpansion(
- username,
- &wallpaper_properties)) {
- *type = User::UNKNOWN;
- *index = ash::GetDefaultWallpaperIndex();
- wallpaper_properties->GetInteger(kWallpaperTypeNodeName,
- reinterpret_cast<int*>(type));
- wallpaper_properties->GetInteger(kWallpaperIndexNodeName, index);
- }
+ base::DictionaryValue* wallpaper_properties;
+ if (user_wallpapers->GetDictionaryWithoutPathExpansion(
+ username,
+ &wallpaper_properties)) {
+ *type = User::UNKNOWN;
+ *index = ash::GetDefaultWallpaperIndex();
+ wallpaper_properties->GetInteger(kWallpaperTypeNodeName,
+ reinterpret_cast<int*>(type));
+ wallpaper_properties->GetInteger(kWallpaperIndexNodeName, index);
}
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698