| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/download/download_item_model.h" | 5 #include "chrome/browser/download/download_item_model.h" |
| 6 | 6 |
| 7 #include "base/i18n/number_formatting.h" | 7 #include "base/i18n/number_formatting.h" |
| 8 #include "base/i18n/rtl.h" | 8 #include "base/i18n/rtl.h" |
| 9 #include "base/string16.h" | 9 #include "base/string16.h" |
| 10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 status_text = l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_REMOVED); | 182 status_text = l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_REMOVED); |
| 183 } else { | 183 } else { |
| 184 status_text.clear(); | 184 status_text.clear(); |
| 185 } | 185 } |
| 186 break; | 186 break; |
| 187 case DownloadItem::CANCELLED: | 187 case DownloadItem::CANCELLED: |
| 188 status_text = l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_CANCELLED); | 188 status_text = l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_CANCELLED); |
| 189 break; | 189 break; |
| 190 case DownloadItem::INTERRUPTED: { | 190 case DownloadItem::INTERRUPTED: { |
| 191 content::DownloadInterruptReason reason = download_->GetLastReason(); | 191 content::DownloadInterruptReason reason = download_->GetLastReason(); |
| 192 // TODO(ahendrickson) -- Add information about whether or not it can be |
| 193 // resumed. |
| 192 if (reason != content::DOWNLOAD_INTERRUPT_REASON_USER_CANCELED) { | 194 if (reason != content::DOWNLOAD_INTERRUPT_REASON_USER_CANCELED) { |
| 193 string16 interrupt_reason = InterruptReasonStatusMessage(reason); | 195 string16 interrupt_reason = InterruptReasonStatusMessage(reason); |
| 194 string16 size_ratio = GetProgressSizesString(); | 196 string16 size_ratio = GetProgressSizesString(); |
| 195 status_text = l10n_util::GetStringFUTF16( | 197 status_text = l10n_util::GetStringFUTF16( |
| 196 IDS_DOWNLOAD_STATUS_INTERRUPTED, size_ratio, interrupt_reason); | 198 IDS_DOWNLOAD_STATUS_INTERRUPTED, size_ratio, interrupt_reason); |
| 197 } else { | 199 } else { |
| 198 // Same as DownloadItem::CANCELLED. | 200 // Same as DownloadItem::CANCELLED. |
| 199 status_text = l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_CANCELLED); | 201 status_text = l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_CANCELLED); |
| 200 } | 202 } |
| 201 break; | 203 break; |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 string16 size_ratio = GetProgressSizesString(); | 381 string16 size_ratio = GetProgressSizesString(); |
| 380 | 382 |
| 381 // The download is a CRX (app, extension, theme, ...) and it is being unpacked | 383 // The download is a CRX (app, extension, theme, ...) and it is being unpacked |
| 382 // and validated. | 384 // and validated. |
| 383 if (download_->AllDataSaved() && | 385 if (download_->AllDataSaved() && |
| 384 download_crx_util::IsExtensionDownload(*download_)) { | 386 download_crx_util::IsExtensionDownload(*download_)) { |
| 385 return l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_CRX_INSTALL_RUNNING); | 387 return l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_CRX_INSTALL_RUNNING); |
| 386 } | 388 } |
| 387 | 389 |
| 388 // A paused download: "100/120 MB, Paused" | 390 // A paused download: "100/120 MB, Paused" |
| 389 if (download_->IsPaused()) { | 391 if (download_->IsPaused() || download_->CanResumeInterrupted()) { |
| 390 return l10n_util::GetStringFUTF16( | 392 return l10n_util::GetStringFUTF16( |
| 391 IDS_DOWNLOAD_STATUS_IN_PROGRESS, size_ratio, | 393 IDS_DOWNLOAD_STATUS_IN_PROGRESS, size_ratio, |
| 392 l10n_util::GetStringUTF16(IDS_DOWNLOAD_PROGRESS_PAUSED)); | 394 l10n_util::GetStringUTF16(IDS_DOWNLOAD_PROGRESS_PAUSED)); |
| 393 } | 395 } |
| 394 | 396 |
| 395 // A download scheduled to be opened when complete: "Opening in 10 secs" | 397 // A download scheduled to be opened when complete: "Opening in 10 secs" |
| 396 if (download_->GetOpenWhenComplete()) { | 398 if (download_->GetOpenWhenComplete()) { |
| 397 if (!time_remaining_known) | 399 if (!time_remaining_known) |
| 398 return l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_OPEN_WHEN_COMPLETE); | 400 return l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_OPEN_WHEN_COMPLETE); |
| 399 | 401 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 418 // We haven't started the upload yet. The download needs to progress | 420 // We haven't started the upload yet. The download needs to progress |
| 419 // further before we will see any upload progress. Show "Downloading..." | 421 // further before we will see any upload progress. Show "Downloading..." |
| 420 // until we start uploading. | 422 // until we start uploading. |
| 421 if (IsDriveDownload()) | 423 if (IsDriveDownload()) |
| 422 return l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_WAITING); | 424 return l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_WAITING); |
| 423 #endif | 425 #endif |
| 424 | 426 |
| 425 // Instead of displaying "0 B" we say "Starting..." | 427 // Instead of displaying "0 B" we say "Starting..." |
| 426 return l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_STARTING); | 428 return l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_STARTING); |
| 427 } | 429 } |
| OLD | NEW |