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

Unified Diff: chrome/browser/extensions/api/tabs/tabs_api.cc

Issue 707853003: Show a better error message for captureVisibleTab than just "internal error". (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 | « no previous file | chrome/browser/extensions/api/tabs/tabs_constants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/tabs/tabs_api.cc
diff --git a/chrome/browser/extensions/api/tabs/tabs_api.cc b/chrome/browser/extensions/api/tabs/tabs_api.cc
index 9343ee08d02e1da68c2315bc8462fe6f17fd7082..1531a4daf27607721072c90f947a78bbdd2d9a53 100644
--- a/chrome/browser/extensions/api/tabs/tabs_api.cc
+++ b/chrome/browser/extensions/api/tabs/tabs_api.cc
@@ -1545,7 +1545,7 @@ WebContents* TabsCaptureVisibleTabFunction::GetWebContentsForID(int window_id) {
WebContents* contents = browser->tab_strip_model()->GetActiveWebContents();
if (!contents) {
- error_ = keys::kInternalVisibleTabCaptureError;
+ error_ = "No active web contents to capture";
return NULL;
}
@@ -1557,7 +1557,20 @@ WebContents* TabsCaptureVisibleTabFunction::GetWebContentsForID(int window_id) {
}
void TabsCaptureVisibleTabFunction::OnCaptureFailure(FailureReason reason) {
- error_ = keys::kInternalVisibleTabCaptureError;
+ const char* reason_description = "internal error";
+ switch (reason) {
+ case FAILURE_REASON_UNKNOWN:
+ reason_description = "unknown error";
+ break;
+ case FAILURE_REASON_ENCODING_FAILED:
+ reason_description = "encoding failed";
+ break;
+ case FAILURE_REASON_VIEW_INVISIBLE:
+ reason_description = "view is invisible";
+ break;
+ }
+ error_ = ErrorUtils::FormatErrorMessage("Failed to capture tab: *",
+ reason_description);
SendResponse(false);
}
« no previous file with comments | « no previous file | chrome/browser/extensions/api/tabs/tabs_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698