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

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

Issue 11092078: Add some error messages for setting wallpaper failures on Chrome(c++) side. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: nits Created 8 years, 2 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 7c7e361b4c2e54bc6e5b270d2dd880b1c44179b7..ad6f58ea1b2e283f1bace10a3dd09a2224f0f5cb 100644
--- a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc
+++ b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc
@@ -99,7 +99,7 @@ class WallpaperFunctionBase::WallpaperDecoder : public ImageDecoder::Delegate {
gfx::ImageSkia final_image(decoded_image);
final_image.MakeThreadSafe();
if (cancel_flag_.IsSet()) {
- function_->OnFailureOrCancel();
+ function_->OnFailureOrCancel("Loading canceled");
Nikita (slow) 2012/10/15 15:14:11 I believe these should be taken from strings i.e.
bshe 2012/10/17 00:13:51 Pre discussion with kuscher, when wallpaper decodi
delete this;
return;
}
@@ -108,8 +108,7 @@ class WallpaperFunctionBase::WallpaperDecoder : public ImageDecoder::Delegate {
}
virtual void OnDecodeImageFailed(const ImageDecoder* decoder) OVERRIDE {
- function_->OnFailureOrCancel();
- // TODO(bshe): Dispatches an encoding error event.
+ function_->OnFailureOrCancel("Loading failed");
bshe 2012/10/17 00:13:51 Changed to localized string.
delete this;
}
@@ -130,6 +129,12 @@ WallpaperFunctionBase::WallpaperFunctionBase() {
WallpaperFunctionBase::~WallpaperFunctionBase() {
}
+void WallpaperFunctionBase::OnFailureOrCancel(const std::string& error) {
+ wallpaper_decoder_ = NULL;
+ SetResult(Value::CreateStringValue(error));
+ SendResponse(false);
+}
+
WallpaperSetWallpaperFunction::WallpaperSetWallpaperFunction() {
}
@@ -172,11 +177,6 @@ void WallpaperSetWallpaperFunction::OnWallpaperDecoded(
this));
}
-void WallpaperSetWallpaperFunction::OnFailureOrCancel() {
- wallpaper_decoder_ = NULL;
- SendResponse(false);
-}
-
void WallpaperSetWallpaperFunction::SaveToFile() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
FilePath wallpaper_dir;
@@ -186,7 +186,7 @@ void WallpaperSetWallpaperFunction::SaveToFile() {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(&WallpaperSetWallpaperFunction::OnFailureOrCancel,
- this));
+ this, "Failed to create directory"));
bshe 2012/10/17 00:13:51 Pre discussion with kuscher, this case should be r
return;
}
std::string file_name = GURL(url_).ExtractFileName();
@@ -212,7 +212,7 @@ void WallpaperSetWallpaperFunction::SaveToFile() {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(&WallpaperSetWallpaperFunction::OnFailureOrCancel,
- this));
+ this, "Failed to save downloaded wallpaper"));
}
}
@@ -229,6 +229,7 @@ void WallpaperSetWallpaperFunction::SetDecodedWallpaper() {
base::Time::Now().LocalMidnight()
};
wallpaper_manager->SetUserWallpaperInfo(email_, info, is_persistent);
+ SetResult(Value::CreateStringValue(""));
SendResponse(true);
}
@@ -272,10 +273,6 @@ void WallpaperSetCustomWallpaperFunction::OnWallpaperDecoded(
email_, layout_, chromeos::User::CUSTOMIZED,
base::WeakPtr<chromeos::WallpaperDelegate>(), image);
wallpaper_decoder_ = NULL;
+ SetResult(Value::CreateStringValue(""));
SendResponse(true);
}
-
-void WallpaperSetCustomWallpaperFunction::OnFailureOrCancel() {
- wallpaper_decoder_ = NULL;
- SendResponse(false);
-}

Powered by Google App Engine
This is Rietveld 408576698