From 98a28aaa8a734d4331b2cb8e8c2be0e389096b0b Mon Sep 17 00:00:00 2001 From: "alemate@chromium.org" Date: Tue, 3 Jun 2014 00:06:22 +0000 Subject: [PATCH] Use default wallpaper when user wallpaper info points to empty file path. In tests user wallpaper info can point to empty paths. Use default wallpaper in this case. BUG=371295 TEST=none Review URL: https://codereview.chromium.org/309643008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274383 0039d316-1c4b-4281-b951-d872f2087c98 --- .../chromeos/login/users/wallpaper/wallpaper_manager.cc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc index 10fa0b1dafcb..6b1bd991b008 100644 --- a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc +++ b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc @@ -1055,6 +1055,13 @@ void WallpaperManager::ScheduleSetUserWallpaper(const std::string& user_id, GetPendingWallpaper(user_id, delayed) ->ResetSetWallpaperImage(user_wallpaper, info); } else { + if (info.file.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(); + return; + } + if (info.type == User::CUSTOMIZED || info.type == User::POLICY) { const char* sub_dir = GetCustomWallpaperSubdirForCurrentResolution(); // Wallpaper is not resized when layout is ash::WALLPAPER_LAYOUT_CENTER. @@ -1074,13 +1081,6 @@ void WallpaperManager::ScheduleSetUserWallpaper(const std::string& user_id, return; } - if (info.file.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(); - return; - } - // Load downloaded ONLINE or converted DEFAULT wallpapers. GetPendingWallpaper(user_id, delayed)->ResetLoadWallpaper(info); } @@ -1169,6 +1169,9 @@ void WallpaperManager::CacheUserWallpaper(const std::string& user_id) { return; WallpaperInfo info; if (GetUserWallpaperInfo(user_id, &info)) { + if (info.file.empty()) + return; + base::FilePath wallpaper_dir; base::FilePath wallpaper_path; if (info.type == User::CUSTOMIZED || info.type == User::POLICY) { -- 2.11.4.GIT