Commit 653a5145 authored by bshe@chromium.org's avatar bshe@chromium.org

Fall back to use default wallpaper index when the logged in user didn't have...

Fall back to use default wallpaper index when the logged in user didn't have index saved in LocalState.


BUG=130685
TEST=
1. Install R20 build
2. Add few new users
3. Verify that all new added users have default wallpaper set(Do not change wallpaper)
4. Autoupdate to R21 build
5. Check the existing users desktop wallpaper

Expected: default wallpaper should show up instead of a black wallpaper.

Review URL: https://chromiumcodereview.appspot.com/10527006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141224 0039d316-1c4b-4281-b951-d872f2087c98
parent 32a7fc85
...@@ -984,7 +984,6 @@ void UserManagerImpl::MigrateWallpaperData() { ...@@ -984,7 +984,6 @@ void UserManagerImpl::MigrateWallpaperData() {
const DictionaryValue* user_wallpapers = const DictionaryValue* user_wallpapers =
local_state->GetDictionary(kUserWallpapers); local_state->GetDictionary(kUserWallpapers);
int index; int index;
if (user_wallpapers) {
const UserList& users = GetUsers(); const UserList& users = GetUsers();
for (UserList::const_iterator it = users.begin(); for (UserList::const_iterator it = users.begin();
it != users.end(); it != users.end();
...@@ -996,7 +995,20 @@ void UserManagerImpl::MigrateWallpaperData() { ...@@ -996,7 +995,20 @@ void UserManagerImpl::MigrateWallpaperData() {
kUserWallpapers); kUserWallpapers);
prefs_wallpapers_update->RemoveWithoutPathExpansion(username, NULL); prefs_wallpapers_update->RemoveWithoutPathExpansion(username, NULL);
SaveUserWallpaperProperties(username, User::DEFAULT, index); 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());
} }
} }
} }
...@@ -1065,7 +1077,6 @@ void UserManagerImpl::GetUserWallpaperProperties(const std::string& username, ...@@ -1065,7 +1077,6 @@ void UserManagerImpl::GetUserWallpaperProperties(const std::string& username,
if (!username.empty()) { if (!username.empty()) {
const DictionaryValue* user_wallpapers = g_browser_process->local_state()-> const DictionaryValue* user_wallpapers = g_browser_process->local_state()->
GetDictionary(UserManager::kUserWallpapersProperties); GetDictionary(UserManager::kUserWallpapersProperties);
if (user_wallpapers) {
base::DictionaryValue* wallpaper_properties; base::DictionaryValue* wallpaper_properties;
if (user_wallpapers->GetDictionaryWithoutPathExpansion( if (user_wallpapers->GetDictionaryWithoutPathExpansion(
username, username,
...@@ -1077,7 +1088,6 @@ void UserManagerImpl::GetUserWallpaperProperties(const std::string& username, ...@@ -1077,7 +1088,6 @@ void UserManagerImpl::GetUserWallpaperProperties(const std::string& username,
wallpaper_properties->GetInteger(kWallpaperIndexNodeName, index); wallpaper_properties->GetInteger(kWallpaperIndexNodeName, index);
} }
} }
}
} }
void UserManagerImpl::SaveUserWallpaperProperties(const std::string& username, void UserManagerImpl::SaveUserWallpaperProperties(const std::string& username,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment