Commit a9e77f48 authored by bshe@chromium.org's avatar bshe@chromium.org

Remove wallpaper thumbnail related c++ code. Thumbnail is now generated by javascript.

BUG=159714

Review URL: https://codereview.chromium.org/11316305

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171040 0039d316-1c4b-4281-b951-d872f2087c98
parent 27612e55
...@@ -70,16 +70,6 @@ const char kNewWallpaperTypeNodeName[] = "type"; ...@@ -70,16 +70,6 @@ const char kNewWallpaperTypeNodeName[] = "type";
// File path suffix of the original custom wallpaper. // File path suffix of the original custom wallpaper.
const char kOriginalCustomWallpaperSuffix[] = "_wallpaper"; const char kOriginalCustomWallpaperSuffix[] = "_wallpaper";
gfx::ImageSkia GetWallpaperThumbnail(const gfx::ImageSkia& wallpaper) {
gfx::ImageSkia thumbnail = gfx::ImageSkiaOperations::CreateResizedImage(
wallpaper,
skia::ImageOperations::RESIZE_LANCZOS3,
gfx::Size(kThumbnailWidth, kThumbnailHeight));
thumbnail.MakeThreadSafe();
return thumbnail;
}
// For our scaling ratios we need to round positive numbers. // For our scaling ratios we need to round positive numbers.
int RoundPositive(double x) { int RoundPositive(double x) {
return static_cast<int>(floor(x + 0.5)); return static_cast<int>(floor(x + 0.5));
...@@ -194,16 +184,6 @@ FilePath WallpaperManager::GetWallpaperPathForUser(const std::string& username, ...@@ -194,16 +184,6 @@ FilePath WallpaperManager::GetWallpaperPathForUser(const std::string& username,
return user_data_dir.AppendASCII(filename); return user_data_dir.AppendASCII(filename);
} }
gfx::ImageSkia WallpaperManager::GetCustomWallpaperThumbnail(
const std::string& email) {
CustomWallpaperMap::const_iterator it =
custom_wallpaper_thumbnail_cache_.find(email);
if (it != custom_wallpaper_thumbnail_cache_.end())
return (*it).second;
else
return gfx::ImageSkia();
}
bool WallpaperManager::GetLoggedInUserWallpaperInfo(WallpaperInfo* info) { bool WallpaperManager::GetLoggedInUserWallpaperInfo(WallpaperInfo* info) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
...@@ -634,14 +614,6 @@ void WallpaperManager::CacheUserWallpaper(const std::string& email) { ...@@ -634,14 +614,6 @@ void WallpaperManager::CacheUserWallpaper(const std::string& email) {
} }
} }
void WallpaperManager::CacheThumbnail(const std::string& email,
scoped_ptr<gfx::ImageSkia> wallpaper) {
DCHECK(BrowserThread::GetBlockingPool()->
IsRunningSequenceOnCurrentThread(sequence_token_));
custom_wallpaper_thumbnail_cache_[email] =
GetWallpaperThumbnail(*wallpaper.get());
}
void WallpaperManager::ClearObsoleteWallpaperPrefs() { void WallpaperManager::ClearObsoleteWallpaperPrefs() {
PrefService* prefs = g_browser_process->local_state(); PrefService* prefs = g_browser_process->local_state();
DictionaryPrefUpdate wallpaper_properties_pref(prefs, DictionaryPrefUpdate wallpaper_properties_pref(prefs,
...@@ -771,15 +743,6 @@ bool WallpaperManager::GetUserWallpaperInfo(const std::string& email, ...@@ -771,15 +743,6 @@ bool WallpaperManager::GetUserWallpaperInfo(const std::string& email,
return false; return false;
} }
void WallpaperManager::GenerateUserWallpaperThumbnail(
const std::string& email,
User::WallpaperType type,
const gfx::ImageSkia& wallpaper) {
DCHECK(BrowserThread::GetBlockingPool()->
IsRunningSequenceOnCurrentThread(sequence_token_));
custom_wallpaper_thumbnail_cache_[email] = GetWallpaperThumbnail(wallpaper);
}
void WallpaperManager::GetCustomWallpaperInternal( void WallpaperManager::GetCustomWallpaperInternal(
const std::string& email, const std::string& email,
const WallpaperInfo& info, const WallpaperInfo& info,
...@@ -836,14 +799,6 @@ void WallpaperManager::OnWallpaperDecoded(const std::string& email, ...@@ -836,14 +799,6 @@ void WallpaperManager::OnWallpaperDecoded(const std::string& email,
SetDefaultWallpaper(); SetDefaultWallpaper();
return; return;
} }
// Generate all reps before passing to another thread.
wallpaper.image().EnsureRepsForSupportedScaleFactors();
scoped_ptr<gfx::ImageSkia> deep_copy(wallpaper.image().DeepCopy());
task_runner_->PostTask(FROM_HERE,
base::Bind(&WallpaperManager::CacheThumbnail,
base::Unretained(this), email,
base::Passed(&deep_copy)));
// Only cache user wallpaper at login screen. // Only cache user wallpaper at login screen.
if (!UserManager::Get()->IsUserLoggedIn()) { if (!UserManager::Get()->IsUserLoggedIn()) {
...@@ -864,7 +819,6 @@ void WallpaperManager::ProcessCustomWallpaper( ...@@ -864,7 +819,6 @@ void WallpaperManager::ProcessCustomWallpaper(
DCHECK(BrowserThread::GetBlockingPool()-> DCHECK(BrowserThread::GetBlockingPool()->
IsRunningSequenceOnCurrentThread(sequence_token_)); IsRunningSequenceOnCurrentThread(sequence_token_));
UserImage wallpaper(*image.get(), raw_image); UserImage wallpaper(*image.get(), raw_image);
GenerateUserWallpaperThumbnail(email, info.type, wallpaper.image());
if (persistent) if (persistent)
SaveCustomWallpaper(email, FilePath(info.file), info.layout, wallpaper); SaveCustomWallpaper(email, FilePath(info.file), info.layout, wallpaper);
} }
......
...@@ -91,9 +91,6 @@ class WallpaperManager: public system::TimezoneSettings::Observer, ...@@ -91,9 +91,6 @@ class WallpaperManager: public system::TimezoneSettings::Observer,
FilePath GetWallpaperPathForUser(const std::string& username, FilePath GetWallpaperPathForUser(const std::string& username,
bool is_small); bool is_small);
// Gets the thumbnail of custom wallpaper from cache.
gfx::ImageSkia GetCustomWallpaperThumbnail(const std::string& email);
// Gets wallpaper information of logged in user. // Gets wallpaper information of logged in user.
bool GetLoggedInUserWallpaperInfo(WallpaperInfo* info); bool GetLoggedInUserWallpaperInfo(WallpaperInfo* info);
...@@ -186,10 +183,6 @@ class WallpaperManager: public system::TimezoneSettings::Observer, ...@@ -186,10 +183,6 @@ class WallpaperManager: public system::TimezoneSettings::Observer,
// Caches |email|'s wallpaper to memory. // Caches |email|'s wallpaper to memory.
void CacheUserWallpaper(const std::string& email); void CacheUserWallpaper(const std::string& email);
// Generates a 128x80 thumbnail and caches it.
void CacheThumbnail(const std::string& email,
scoped_ptr<gfx::ImageSkia> wallpaper);
// Clears all obsolete wallpaper prefs from old version wallpaper pickers. // Clears all obsolete wallpaper prefs from old version wallpaper pickers.
void ClearObsoleteWallpaperPrefs(); void ClearObsoleteWallpaperPrefs();
...@@ -205,11 +198,6 @@ class WallpaperManager: public system::TimezoneSettings::Observer, ...@@ -205,11 +198,6 @@ class WallpaperManager: public system::TimezoneSettings::Observer,
const WallpaperInfo& info, const WallpaperInfo& info,
bool update_wallpaper); bool update_wallpaper);
// Generates a 128x80 thumbnail.
void GenerateUserWallpaperThumbnail(const std::string& email,
User::WallpaperType type,
const gfx::ImageSkia& wallpaper);
// Gets |email|'s custom wallpaper at |wallpaper_path|. Falls back on original // Gets |email|'s custom wallpaper at |wallpaper_path|. Falls back on original
// custom wallpaper. When |update_wallpaper| is true, sets wallpaper to the // custom wallpaper. When |update_wallpaper| is true, sets wallpaper to the
// loaded wallpaper. Must run on FILE thread. // loaded wallpaper. Must run on FILE thread.
...@@ -301,8 +289,6 @@ class WallpaperManager: public system::TimezoneSettings::Observer, ...@@ -301,8 +289,6 @@ class WallpaperManager: public system::TimezoneSettings::Observer,
// Caches wallpapers of users. Accessed only on UI thread. // Caches wallpapers of users. Accessed only on UI thread.
CustomWallpaperMap wallpaper_cache_; CustomWallpaperMap wallpaper_cache_;
CustomWallpaperMap custom_wallpaper_thumbnail_cache_;
// The last selected user on user pod row. // The last selected user on user pod row.
std::string last_selected_user_; std::string last_selected_user_;
......
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