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

Unified Diff: chrome/browser/chromeos/extensions/wallpaper_private_api.cc

Issue 16634016: Support png wallpapers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 months 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
Index: chrome/browser/chromeos/extensions/wallpaper_private_api.cc
diff --git a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc
index ac32448a927415be195b3be98fa00b3ff9615727..b61ee059e48f0bf44a25d0a2d0b10db0396ddb6c 100644
--- a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc
+++ b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc
@@ -235,11 +235,15 @@ class WallpaperFunctionBase::WallpaperDecoder : public ImageDecoder::Delegate {
void Start(const std::string& image_data) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- image_decoder_ = new ImageDecoder(this, image_data,
- ImageDecoder::ROBUST_JPEG_CODEC);
+
+ // This function can only be called after user login. It is fine to use
Nikita (slow) 2013/06/13 13:03:33 Please place CHECK here that like CHECK(chromeos:
bshe 2013/06/14 18:12:18 Done.
+ // unsafe image deocder here. Before user login, a robust jpeg decoder will
+ // be used.
+ unsafe_image_decoder_ = new ImageDecoder(this, image_data,
+ ImageDecoder::DEFAULT_CODEC);
scoped_refptr<base::MessageLoopProxy> task_runner =
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI);
- image_decoder_->Start(task_runner);
+ unsafe_image_decoder_->Start(task_runner);
}
void Cancel() {
@@ -272,7 +276,7 @@ class WallpaperFunctionBase::WallpaperDecoder : public ImageDecoder::Delegate {
private:
scoped_refptr<WallpaperFunctionBase> function_;
- scoped_refptr<ImageDecoder> image_decoder_;
+ scoped_refptr<ImageDecoder> unsafe_image_decoder_;
base::CancellationFlag cancel_flag_;
DISALLOW_COPY_AND_ASSIGN(WallpaperDecoder);
@@ -881,6 +885,8 @@ void WallpaperPrivateGetOfflineWallpaperListFunction::GetList(
DCHECK(BrowserThread::GetBlockingPool()->IsRunningSequenceOnCurrentThread(
sequence_token_));
std::vector<std::string> file_list;
+ // TODO(bshe): This api function is only used for ONLINE wallpapers. Remove
+ // source.
if (source == kOnlineSource) {
base::FilePath wallpaper_dir;
CHECK(PathService::Get(chrome::DIR_CHROMEOS_WALLPAPERS, &wallpaper_dir));
@@ -895,22 +901,6 @@ void WallpaperPrivateGetOfflineWallpaperListFunction::GetList(
file_list.push_back(current.BaseName().value());
}
}
- } else {
- base::FilePath custom_thumbnails_dir = chromeos::WallpaperManager::Get()->
- GetCustomWallpaperPath(chromeos::kThumbnailWallpaperSubDir, email, "");
- if (file_util::DirectoryExists(custom_thumbnails_dir)) {
- file_util::FileEnumerator files(custom_thumbnails_dir, false,
- file_util::FileEnumerator::FILES);
- std::set<std::string> file_name_set;
- for (base::FilePath current = files.Next(); !current.empty();
- current = files.Next()) {
- file_name_set.insert(current.BaseName().value());
- }
- for (std::set<std::string>::reverse_iterator rit = file_name_set.rbegin();
- rit != file_name_set.rend(); ++rit) {
- file_list.push_back(*rit);
- }
- }
}
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,

Powered by Google App Engine
This is Rietveld 408576698