| Index: chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc
|
| diff --git a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc
|
| index e5c2b1dfdb2149c02fdddea45e03c40974919cb3..e38e0f74ceba679d8c3ed61947260d4b89eed146 100644
|
| --- a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc
|
| +++ b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc
|
| @@ -79,7 +79,7 @@ const char kUserWallpapersProperties[] = "UserWallpapersProperties";
|
| // dictionary.
|
| const char kNewWallpaperDateNodeName[] = "date";
|
| const char kNewWallpaperLayoutNodeName[] = "layout";
|
| -const char kNewWallpaperFileNodeName[] = "file";
|
| +const char kNewWallpaperLocationNodeName[] = "file";
|
| const char kNewWallpaperTypeNodeName[] = "type";
|
|
|
| // Maximum number of wallpapers cached by CacheUsersWallpapers().
|
| @@ -396,7 +396,7 @@ void WallpaperManager::PendingWallpaper::ProcessRequest() {
|
| true /* update wallpaper */,
|
| base::Passed(on_finish_.Pass()),
|
| manager->weak_factory_.GetWeakPtr()));
|
| - } else if (!info_.file.empty()) {
|
| + } else if (!info_.location.empty()) {
|
| manager->LoadWallpaper(user_id_, info_, true, on_finish_.Pass());
|
| } else {
|
| // PendingWallpaper was created and never initialized?
|
| @@ -567,7 +567,7 @@ bool WallpaperManager::GetLoggedInUserWallpaperInfo(WallpaperInfo* info) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
|
|
| if (UserManager::Get()->IsLoggedInAsStub()) {
|
| - info->file = current_user_wallpaper_info_.file = "";
|
| + info->location = current_user_wallpaper_info_.location = "";
|
| info->layout = current_user_wallpaper_info_.layout =
|
| ash::WALLPAPER_LAYOUT_CENTER_CROPPED;
|
| info->type = current_user_wallpaper_info_.type =
|
| @@ -674,7 +674,7 @@ void WallpaperManager::RemoveUserWallpaperInfo(const std::string& user_id) {
|
| DictionaryPrefUpdate prefs_wallpapers_info_update(prefs,
|
| prefs::kUsersWallpaperInfo);
|
| prefs_wallpapers_info_update->RemoveWithoutPathExpansion(user_id, NULL);
|
| - DeleteUserWallpapers(user_id, info.file);
|
| + DeleteUserWallpapers(user_id, info.location);
|
| }
|
|
|
| // static
|
| @@ -926,7 +926,7 @@ void WallpaperManager::SetCustomWallpaper(
|
| FROM_HERE,
|
| base::Bind(&WallpaperManager::SaveCustomWallpaper,
|
| user_id_hash,
|
| - base::FilePath(wallpaper_info.file),
|
| + base::FilePath(wallpaper_info.location),
|
| wallpaper_info.layout,
|
| base::Passed(deep_copy.Pass())));
|
| }
|
| @@ -1098,14 +1098,14 @@ void WallpaperManager::GetCustomWallpaperInternal(
|
| // exist. This may happen when the original custom wallpaper is small or
|
| // browser shutdown before resized wallpaper saved.
|
| valid_path = GetCustomWallpaperDir(kOriginalWallpaperSubDir);
|
| - valid_path = valid_path.Append(info.file);
|
| + valid_path = valid_path.Append(info.location);
|
| }
|
|
|
| if (!base::PathExists(valid_path)) {
|
| // Falls back to custom wallpaper that uses email as part of its file path.
|
| // Note that email is used instead of user_id_hash here.
|
| - valid_path =
|
| - GetCustomWallpaperPath(kOriginalWallpaperSubDir, user_id, info.file);
|
| + valid_path = GetCustomWallpaperPath(kOriginalWallpaperSubDir,
|
| + user_id, info.location);
|
| }
|
|
|
| if (!base::PathExists(valid_path)) {
|
| @@ -1132,7 +1132,7 @@ void WallpaperManager::GetCustomWallpaperInternal(
|
|
|
| void WallpaperManager::InitInitialUserWallpaper(const std::string& user_id,
|
| bool is_persistent) {
|
| - current_user_wallpaper_info_.file = "";
|
| + current_user_wallpaper_info_.location = "";
|
| current_user_wallpaper_info_.layout = ash::WALLPAPER_LAYOUT_CENTER_CROPPED;
|
| current_user_wallpaper_info_.type = user_manager::User::DEFAULT;
|
| current_user_wallpaper_info_.date = base::Time::Now().LocalMidnight();
|
| @@ -1156,7 +1156,7 @@ void WallpaperManager::SetUserWallpaperInfo(const std::string& user_id,
|
| base::DictionaryValue* wallpaper_info_dict = new base::DictionaryValue();
|
| wallpaper_info_dict->SetString(kNewWallpaperDateNodeName,
|
| base::Int64ToString(info.date.ToInternalValue()));
|
| - wallpaper_info_dict->SetString(kNewWallpaperFileNodeName, info.file);
|
| + wallpaper_info_dict->SetString(kNewWallpaperLocationNodeName, info.location);
|
| wallpaper_info_dict->SetInteger(kNewWallpaperLayoutNodeName, info.layout);
|
| wallpaper_info_dict->SetInteger(kNewWallpaperTypeNodeName, info.type);
|
| wallpaper_update->SetWithoutPathExpansion(user_id, wallpaper_info_dict);
|
| @@ -1206,7 +1206,7 @@ void WallpaperManager::ScheduleSetUserWallpaper(const std::string& user_id,
|
| GetPendingWallpaper(user_id, delayed)
|
| ->ResetSetWallpaperImage(user_wallpaper, info);
|
| } else {
|
| - if (info.file.empty()) {
|
| + if (info.location.empty()) {
|
| // Uses default built-in wallpaper when file is empty. Eventually, we
|
| // will only ship one built-in wallpaper in ChromeOS image.
|
| GetPendingWallpaper(user_id, delayed)->ResetSetDefaultWallpaper();
|
| @@ -1222,7 +1222,7 @@ void WallpaperManager::ScheduleSetUserWallpaper(const std::string& user_id,
|
| if (info.layout == ash::WALLPAPER_LAYOUT_CENTER)
|
| sub_dir = kOriginalWallpaperSubDir;
|
| base::FilePath wallpaper_path = GetCustomWallpaperDir(sub_dir);
|
| - wallpaper_path = wallpaper_path.Append(info.file);
|
| + wallpaper_path = wallpaper_path.Append(info.location);
|
| if (current_wallpaper_path_ == wallpaper_path)
|
| return;
|
| current_wallpaper_path_ = wallpaper_path;
|
| @@ -1321,7 +1321,7 @@ void WallpaperManager::CacheUserWallpaper(const std::string& user_id) {
|
| return;
|
| WallpaperInfo info;
|
| if (GetUserWallpaperInfo(user_id, &info)) {
|
| - if (info.file.empty())
|
| + if (info.location.empty())
|
| return;
|
|
|
| base::FilePath wallpaper_dir;
|
| @@ -1330,7 +1330,7 @@ void WallpaperManager::CacheUserWallpaper(const std::string& user_id) {
|
| info.type == user_manager::User::POLICY) {
|
| const char* sub_dir = GetCustomWallpaperSubdirForCurrentResolution();
|
| base::FilePath wallpaper_path = GetCustomWallpaperDir(sub_dir);
|
| - wallpaper_path = wallpaper_path.Append(info.file);
|
| + wallpaper_path = wallpaper_path.Append(info.location);
|
| task_runner_->PostTask(
|
| FROM_HERE,
|
| base::Bind(&WallpaperManager::GetCustomWallpaperInternal,
|
| @@ -1443,7 +1443,7 @@ void WallpaperManager::LoadWallpaper(const std::string& user_id,
|
| // Do a sanity check that file path information is not empty.
|
| if (info.type == user_manager::User::ONLINE ||
|
| info.type == user_manager::User::DEFAULT) {
|
| - if (info.file.empty()) {
|
| + if (info.location.empty()) {
|
| if (base::SysInfo::IsRunningOnChromeOS()) {
|
| NOTREACHED() << "User wallpaper info appears to be broken: " << user_id;
|
| } else {
|
| @@ -1459,7 +1459,7 @@ void WallpaperManager::LoadWallpaper(const std::string& user_id,
|
| }
|
|
|
| if (info.type == user_manager::User::ONLINE) {
|
| - std::string file_name = GURL(info.file).ExtractFileName();
|
| + std::string file_name = GURL(info.location).ExtractFileName();
|
| WallpaperResolution resolution = GetAppropriateResolution();
|
| // Only solid color wallpapers have stretch layout and they have only one
|
| // resolution.
|
| @@ -1486,7 +1486,7 @@ void WallpaperManager::LoadWallpaper(const std::string& user_id,
|
| // M26 from M21. See crosbug.com/38429 for details.
|
| base::FilePath user_data_dir;
|
| PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
|
| - wallpaper_path = user_data_dir.Append(info.file);
|
| + wallpaper_path = user_data_dir.Append(info.location);
|
| StartLoad(
|
| user_id, info, update_wallpaper, wallpaper_path, on_finish.Pass());
|
| } else {
|
| @@ -1518,8 +1518,8 @@ bool WallpaperManager::GetUserWallpaperInfo(const std::string& user_id,
|
| }
|
|
|
| // Use temporary variables to keep |info| untouched in the error case.
|
| - std::string file;
|
| - if (!info_dict->GetString(kNewWallpaperFileNodeName, &file))
|
| + std::string location;
|
| + if (!info_dict->GetString(kNewWallpaperLocationNodeName, &location))
|
| return false;
|
| int layout;
|
| if (!info_dict->GetInteger(kNewWallpaperLayoutNodeName, &layout))
|
| @@ -1534,7 +1534,7 @@ bool WallpaperManager::GetUserWallpaperInfo(const std::string& user_id,
|
| if (!base::StringToInt64(date_string, &date_val))
|
| return false;
|
|
|
| - info->file = file;
|
| + info->location = location;
|
| info->layout = static_cast<ash::WallpaperLayout>(layout);
|
| info->type = static_cast<user_manager::User::WallpaperType>(type);
|
| info->date = base::Time::FromInternalValue(date_val);
|
| @@ -1549,9 +1549,7 @@ void WallpaperManager::MoveCustomWallpapersSuccess(
|
| if (info.type == user_manager::User::CUSTOMIZED) {
|
| // New file field should include user id hash in addition to file name.
|
| // This is needed because at login screen, user id hash is not available.
|
| - std::string relative_path =
|
| - base::FilePath(user_id_hash).Append(info.file).value();
|
| - info.file = relative_path;
|
| + info.location = base::FilePath(user_id_hash).Append(info.location).value();
|
| bool is_persistent =
|
| !UserManager::Get()->IsUserNonCryptohomeDataEphemeral(user_id);
|
| SetUserWallpaperInfo(user_id, info, is_persistent);
|
|
|