| Index: chrome/browser/chromeos/login/wallpaper_manager.cc
|
| diff --git a/chrome/browser/chromeos/login/wallpaper_manager.cc b/chrome/browser/chromeos/login/wallpaper_manager.cc
|
| index e0715e023b83829e70b61b49c3275523294f0c11..531aecc03cd2dd15ccdb7d13c173ac2030a8f390 100644
|
| --- a/chrome/browser/chromeos/login/wallpaper_manager.cc
|
| +++ b/chrome/browser/chromeos/login/wallpaper_manager.cc
|
| @@ -467,25 +467,28 @@ void WallpaperManager::SetCustomWallpaper(const std::string& username,
|
|
|
| bool is_persistent = ShouldPersistDataForUser(username);
|
|
|
| - BrowserThread::PostTask(
|
| - BrowserThread::FILE,
|
| - FROM_HERE,
|
| - base::Bind(&WallpaperManager::GenerateUserWallpaperThumbnail,
|
| - base::Unretained(this), username, type, delegate,
|
| - wallpaper.image()));
|
| + wallpaper.image().EnsureRepsForSupportedScaleFactors();
|
| + scoped_ptr<gfx::ImageSkia> deep_copy(wallpaper.image().DeepCopy());
|
|
|
| - if (is_persistent) {
|
| - BrowserThread::PostTask(
|
| + WallpaperInfo wallpaper_info = {
|
| + wallpaper_path,
|
| + layout,
|
| + type,
|
| + // Date field is not used.
|
| + base::Time::Now().LocalMidnight()
|
| + };
|
| + // TODO(bshe): This may break if RawImage becomes RefCountedMemory.
|
| + BrowserThread::PostTask(
|
| BrowserThread::FILE,
|
| FROM_HERE,
|
| - base::Bind(&WallpaperManager::SaveCustomWallpaper,
|
| + base::Bind(&WallpaperManager::ProcessCustomWallpaper,
|
| base::Unretained(this),
|
| username,
|
| - FilePath(wallpaper_path),
|
| - layout,
|
| - wallpaper));
|
| - }
|
| -
|
| + is_persistent,
|
| + wallpaper_info,
|
| + delegate,
|
| + base::Passed(&deep_copy),
|
| + wallpaper.raw_image()));
|
| ash::Shell::GetInstance()->desktop_background_controller()->
|
| SetCustomWallpaper(wallpaper.image(), layout);
|
|
|
| @@ -1104,6 +1107,19 @@ void WallpaperManager::OnWallpaperDecoded(const std::string& email,
|
| }
|
| }
|
|
|
| +void WallpaperManager::ProcessCustomWallpaper(
|
| + const std::string& email,
|
| + bool persistent,
|
| + const WallpaperInfo& info,
|
| + base::WeakPtr<WallpaperDelegate> delegate,
|
| + scoped_ptr<gfx::ImageSkia> image,
|
| + const UserImage::RawImage& raw_image) {
|
| + UserImage wallpaper(*image.get(), raw_image);
|
| + GenerateUserWallpaperThumbnail(email, info.type, delegate, wallpaper.image());
|
| + if (persistent)
|
| + SaveCustomWallpaper(email, FilePath(info.file), info.layout, wallpaper);
|
| +}
|
| +
|
| void WallpaperManager::OnWallpaperEncoded(const FilePath& path,
|
| scoped_refptr<base::RefCountedBytes> data) {
|
| SaveWallpaperInternal(path,
|
|
|