diff options
author | arv@google.com <arv@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-26 23:44:02 +0000 |
---|---|---|
committer | arv@google.com <arv@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-26 23:44:02 +0000 |
commit | 77a7db91faaa47639ae3f41257eb1901999b93dc (patch) | |
tree | 2d49d4c939f960802d4dd8c9d9dfaf8b51a8fad1 | |
parent | 6479c267dd32aab3f043aa2d3b2f808505c031ef (diff) | |
download | chromium_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
-rw-r--r-- | chrome/app/generated_resources.grd | 8 | ||||
-rw-r--r-- | chrome/browser/dom_ui/downloads_dom_handler.cc | 16 |
2 files changed, 19 insertions, 5 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 360428e..9b5fa57 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -1553,10 +1553,14 @@ each locale. --> desc="Cancel link text"> Cancelled </message> - <message name="IDS_DOWNLOAD_TAB_PROGRESS_SPEED" - desc="Speed and received byte counts"> + <message name="IDS_DOWNLOAD_TAB_PROGRESS_STATUS_TIME_UNKNOWN" + desc="The status text for a download in progress in the download manager. This includes information such as speed and received byte counts and is used when we do not know the remaining time"> <ph name="SPEED">$1<ex>10kB/s</ex></ph> - <ph name="RECEIVED_AMOUNT">$2<ex>40kB</ex></ph> </message> + <message name="IDS_DOWNLOAD_TAB_PROGRESS_STATUS" + desc="The status text for a download in progress in the download manager. This includes information such as speed, received byte counts as well as remaining time"> + <ph name="SPEED">$1<ex>10kB/s</ex></ph> - <ph name="RECEIVED_AMOUNT">$2<ex>40kB</ex></ph>, <ph name="TIME_REMAINING">$3<ex>42 mins left</ex></ph> + </message> <message name="IDS_DOWNLOAD_TAB_PROGRESS_SIZE" desc="Speed and received byte counts (with total)"> <ph name="RECEIVED_AMOUNT">$1<ex>40kB</ex></ph> of <ph name="TOTAL_SIZE">$2<ex>250kB</ex></ph> 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); } |