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

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

Issue 147443007: Add support for localized time strings with two units, eg. "2 hours 17 minutes" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Bartosz' 3rd round of comments Created 6 years, 10 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 e1c86df8dd85c0ca3579d6105107979bc09e967a..cd741a43ffda67aef224680b8be369fd7845c2a9 100644
--- a/chrome/browser/download/download_item_model.cc
+++ b/chrome/browser/download/download_item_model.cc
@@ -334,10 +334,13 @@ base::string16 DownloadItemModel::GetTabProgressStatusText() const {
base::TimeDelta remaining;
base::string16 time_remaining;
- if (download_->IsPaused())
+ if (download_->IsPaused()) {
time_remaining = l10n_util::GetStringUTF16(IDS_DOWNLOAD_PROGRESS_PAUSED);
- else if (download_->TimeRemaining(&remaining))
- time_remaining = ui::TimeFormat::TimeRemaining(remaining);
+ } else if (download_->TimeRemaining(&remaining)) {
+ time_remaining = ui::TimeFormat::Simple(ui::TimeFormat::FORMAT_REMAINING,
+ ui::TimeFormat::LENGTH_SHORT,
+ remaining);
+ }
if (time_remaining.empty()) {
base::i18n::AdjustStringForLocaleDirection(&amount);
@@ -627,14 +630,16 @@ base::string16 DownloadItemModel::GetInProgressStatusString() const {
return l10n_util::GetStringFUTF16(
IDS_DOWNLOAD_STATUS_OPEN_IN,
- ui::TimeFormat::TimeDurationShort(time_remaining));
+ ui::TimeFormat::Simple(ui::TimeFormat::FORMAT_DURATION,
+ ui::TimeFormat::LENGTH_SHORT, time_remaining));
}
// In progress download with known time left: "100/120 MB, 10 secs left"
if (time_remaining_known) {
return l10n_util::GetStringFUTF16(
IDS_DOWNLOAD_STATUS_IN_PROGRESS, size_ratio,
- ui::TimeFormat::TimeRemaining(time_remaining));
+ ui::TimeFormat::Simple(ui::TimeFormat::FORMAT_REMAINING,
+ ui::TimeFormat::LENGTH_SHORT, time_remaining));
}
// In progress download with no known time left and non-zero completed bytes:

Powered by Google App Engine
This is Rietveld 408576698