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

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

Issue 11366143: Fix the crash in DesktopBackgroundView::OnPaint (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Oshima's review and rebase to TOT Created 8 years, 1 month 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 | « chrome/browser/chromeos/login/wallpaper_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « chrome/browser/chromeos/login/wallpaper_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698