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

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

Issue 23496076: WIP - Refactor programmatic downloads Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 d7983808ac0b2f9e32005431b8c50d7af70af95a..419f61293981e8e90a58d99bb275013c4eb453dd 100644
--- a/chrome/browser/download/download_item_model.cc
+++ b/chrome/browser/download/download_item_model.cc
@@ -95,9 +95,9 @@ DownloadItemModelData::DownloadItemModelData()
}
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;
@@ -125,6 +125,7 @@ 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;
@@ -152,19 +153,23 @@ 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:
+ case content::DOWNLOAD_INTERRUPT_REASON_SERVER_NO_RANGE:
+ case content::DOWNLOAD_INTERRUPT_REASON_SERVER_PRECONDITION:
+ NOTREACHED();
+ // fallthrough
+ case content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED:
string_id = IDS_DOWNLOAD_INTERRUPTED_STATUS;
- break;
}
return l10n_util::GetStringUTF16(string_id);
}
string16 InterruptReasonMessage(int reason) {
- int string_id = 0;
+ int string_id = IDS_DOWNLOAD_INTERRUPTED_STATUS;
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;
@@ -192,6 +197,7 @@ 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;
@@ -219,9 +225,13 @@ 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:
+ case content::DOWNLOAD_INTERRUPT_REASON_SERVER_NO_RANGE:
+ case content::DOWNLOAD_INTERRUPT_REASON_SERVER_PRECONDITION:
+ NOTREACHED();
+ // fallthrough
+ 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