summaryrefslogtreecommitdiffstats
path: root/chrome/browser/dom_ui
diff options
context:
space:
mode:
authorarv@google.com <arv@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-26 23:44:02 +0000
committerarv@google.com <arv@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-26 23:44:02 +0000
commit77a7db91faaa47639ae3f41257eb1901999b93dc (patch)
tree2d49d4c939f960802d4dd8c9d9dfaf8b51a8fad1 /chrome/browser/dom_ui
parent6479c267dd32aab3f043aa2d3b2f808505c031ef (diff)
downloadchromium_src-77a7db91faaa47639ae3f41257eb1901999b93dc.zip
chromium_src-77a7db91faaa47639ae3f41257eb1901999b93dc.tar.gz
chromium_src-77a7db91faaa47639ae3f41257eb1901999b93dc.tar.bz2
Show the time remaining of download items in the download manager.
BUG=9607 TEST=Download a large file and go to the download manager (Ctrl+J). The remaining time of your current downloads should decreasen as the download is getting closer to being done. Review URL: http://codereview.chromium.org/115797 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16949 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/dom_ui')
-rw-r--r--chrome/browser/dom_ui/downloads_dom_handler.cc16
1 files changed, 13 insertions, 3 deletions
diff --git a/chrome/browser/dom_ui/downloads_dom_handler.cc b/chrome/browser/dom_ui/downloads_dom_handler.cc
index f38a664..a1de5a8 100644
--- a/chrome/browser/dom_ui/downloads_dom_handler.cc
+++ b/chrome/browser/dom_ui/downloads_dom_handler.cc
@@ -332,7 +332,17 @@ std::wstring DownloadsDOMHandler::GetProgressStatusText(
&speed_text_localized))
speed_text.assign(speed_text_localized);
- return l10n_util::GetStringF(IDS_DOWNLOAD_TAB_PROGRESS_SPEED,
- speed_text,
- amount);
+ base::TimeDelta remaining;
+ std::wstring time_remaining;
+ if (download->is_paused())
+ time_remaining = l10n_util::GetString(IDS_DOWNLOAD_PROGRESS_PAUSED);
+ else if (download->TimeRemaining(&remaining))
+ time_remaining = TimeFormat::TimeRemaining(remaining);
+
+ if (time_remaining.empty()) {
+ return l10n_util::GetStringF(IDS_DOWNLOAD_TAB_PROGRESS_STATUS_TIME_UNKNOWN,
+ speed_text, amount);
+ }
+ return l10n_util::GetStringF(IDS_DOWNLOAD_TAB_PROGRESS_STATUS, amount,
+ time_remaining);
}