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

Unified Diff: chrome/browser/download/download_item_model.cc

Issue 114193009: [Download] Return DownloadInterruptReason from OnStartedCallback (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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/download/download_item_model.cc
diff --git a/chrome/browser/download/download_item_model.cc b/chrome/browser/download/download_item_model.cc
index 385f07f012ecb59326005e7e372fe247cf1139e5..ab04b5e5ae33d24e42858928aa8816b09f0bd846 100644
--- a/chrome/browser/download/download_item_model.cc
+++ b/chrome/browser/download/download_item_model.cc
@@ -110,9 +110,9 @@ DownloadItemModelData::DownloadItemModelData()
}
base::string16 InterruptReasonStatusMessage(int reason) {
- int string_id = 0;
+ int string_id = IDS_DOWNLOAD_INTERRUPTED_STATUS;
- switch (reason) {
+ switch (static_cast<content::DownloadInterruptReason>(reason)) {
case content::DOWNLOAD_INTERRUPT_REASON_FILE_ACCESS_DENIED:
string_id = IDS_DOWNLOAD_INTERRUPTED_STATUS_ACCESS_DENIED;
break;
@@ -140,6 +140,7 @@ base::string16 InterruptReasonStatusMessage(int reason) {
case content::DOWNLOAD_INTERRUPT_REASON_FILE_TOO_SHORT:
string_id = IDS_DOWNLOAD_INTERRUPTED_STATUS_FILE_TOO_SHORT;
break;
+ case content::DOWNLOAD_INTERRUPT_REASON_NETWORK_INVALID_REQUEST:
case content::DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED:
string_id = IDS_DOWNLOAD_INTERRUPTED_STATUS_NETWORK_ERROR;
break;
@@ -167,19 +168,23 @@ base::string16 InterruptReasonStatusMessage(int reason) {
case content::DOWNLOAD_INTERRUPT_REASON_CRASH:
string_id = IDS_DOWNLOAD_INTERRUPTED_STATUS_CRASH;
break;
- default:
+ case content::DOWNLOAD_INTERRUPT_REASON_NONE:
+ NOTREACHED();
+ // fallthrough
+ case content::DOWNLOAD_INTERRUPT_REASON_SERVER_NO_RANGE:
+ case content::DOWNLOAD_INTERRUPT_REASON_SERVER_PRECONDITION:
+ case content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED:
string_id = IDS_DOWNLOAD_INTERRUPTED_STATUS;
- break;
}
return l10n_util::GetStringUTF16(string_id);
}
base::string16 InterruptReasonMessage(int reason) {
- int string_id = 0;
+ int string_id = IDS_DOWNLOAD_INTERRUPTED_STATUS;
base::string16 status_text;
- switch (reason) {
+ switch (static_cast<content::DownloadInterruptReason>(reason)) {
case content::DOWNLOAD_INTERRUPT_REASON_FILE_ACCESS_DENIED:
string_id = IDS_DOWNLOAD_INTERRUPTED_DESCRIPTION_ACCESS_DENIED;
break;
@@ -207,6 +212,7 @@ base::string16 InterruptReasonMessage(int reason) {
case content::DOWNLOAD_INTERRUPT_REASON_FILE_TOO_SHORT:
string_id = IDS_DOWNLOAD_INTERRUPTED_DESCRIPTION_FILE_TOO_SHORT;
break;
+ case content::DOWNLOAD_INTERRUPT_REASON_NETWORK_INVALID_REQUEST:
case content::DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED:
string_id = IDS_DOWNLOAD_INTERRUPTED_DESCRIPTION_NETWORK_ERROR;
break;
@@ -234,9 +240,13 @@ base::string16 InterruptReasonMessage(int reason) {
case content::DOWNLOAD_INTERRUPT_REASON_CRASH:
string_id = IDS_DOWNLOAD_INTERRUPTED_DESCRIPTION_CRASH;
break;
- default:
+ case content::DOWNLOAD_INTERRUPT_REASON_NONE:
+ NOTREACHED();
+ // fallthrough
+ case content::DOWNLOAD_INTERRUPT_REASON_SERVER_NO_RANGE:
+ case content::DOWNLOAD_INTERRUPT_REASON_SERVER_PRECONDITION:
+ case content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED:
string_id = IDS_DOWNLOAD_INTERRUPTED_STATUS;
- break;
}
status_text = l10n_util::GetStringUTF16(string_id);
« no previous file with comments | « chrome/browser/download/download_browsertest.cc ('k') | chrome/browser/download/download_item_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698