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

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: spelling 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/extensions/wallpaper_private_apitest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6111c33d548a67566181c5eee76b45bc21ec2cfb..228207e55d1ff02514425381ef666394b4441b18 100644
--- a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc
+++ b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc
@@ -27,6 +27,7 @@
#include "chrome/browser/extensions/event_router.h"
#include "chrome/browser/image_decoder.h"
#include "chrome/common/chrome_paths.h"
+#include "chromeos/login/login_state.h"
#include "content/public/browser/browser_thread.h"
#include "googleurl/src/gurl.h"
#include "grit/app_locale_settings.h"
@@ -236,11 +237,16 @@ 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
+ // unsafe image decoder here. Before user login, a robust jpeg decoder will
+ // be used.
+ CHECK(chromeos::LoginState::Get()->IsUserLoggedIn());
+ 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() {
@@ -273,7 +279,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);
@@ -882,6 +888,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));
@@ -896,22 +904,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)) {
- base::FileEnumerator files(custom_thumbnails_dir, false,
- base::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,
« no previous file with comments | « no previous file | chrome/browser/chromeos/extensions/wallpaper_private_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698