diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-19 23:11:28 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-19 23:11:28 +0000 |
commit | 7b83a107f3feaa0bd220b0ac6f983d7a3b82c44e (patch) | |
tree | 3f64360ee3d06327326187ace7065957c264efe2 /chrome/browser/download | |
parent | c48d1ef5985b7084bdbca953db85fae43ca564c5 (diff) | |
download | chromium_src-7b83a107f3feaa0bd220b0ac6f983d7a3b82c44e.zip chromium_src-7b83a107f3feaa0bd220b0ac6f983d7a3b82c44e.tar.gz chromium_src-7b83a107f3feaa0bd220b0ac6f983d7a3b82c44e.tar.bz2 |
Convert FormatBytes to string16.
I considered ASCII, but it's producing what is intended to be a
human-readable string. For example, in theory the "bytes/s" annotation
could be localized into a language where the "b" is non-ASCII.
Review URL: http://codereview.chromium.org/3107021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56771 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/download')
-rw-r--r-- | chrome/browser/download/download_item_model.cc | 11 | ||||
-rw-r--r-- | chrome/browser/download/download_util.cc | 11 |
2 files changed, 11 insertions, 11 deletions
diff --git a/chrome/browser/download/download_item_model.cc b/chrome/browser/download/download_item_model.cc index c360273..48c75ad 100644 --- a/chrome/browser/download/download_item_model.cc +++ b/chrome/browser/download/download_item_model.cc @@ -32,17 +32,15 @@ std::wstring DownloadItemModel::GetStatusText() { int64 total = download_->total_bytes(); DataUnits amount_units = GetByteDisplayUnits(total); - const string16 simple_size = WideToUTF16Hack(FormatBytes(size, amount_units, - false)); + const string16 simple_size = FormatBytes(size, amount_units, false); // In RTL locales, we render the text "size/total" in an RTL context. This // is problematic since a string such as "123/456 MB" is displayed // as "MB 123/456" because it ends with an LTR run. In order to solve this, // we mark the total string as an LTR string if the UI layout is // right-to-left so that the string "456 MB" is treated as an LTR run. - string16 simple_total = WideToUTF16Hack(FormatBytes(total, amount_units, - true)); - simple_total = base::i18n::GetDisplayStringInLTRDirectionality(simple_total); + string16 simple_total = base::i18n::GetDisplayStringInLTRDirectionality( + FormatBytes(total, amount_units, true)); TimeDelta remaining; string16 simple_time; @@ -71,8 +69,7 @@ std::wstring DownloadItemModel::GetStatusText() { // Instead of displaying "0 B" we keep the "Starting..." string. status_text = (size == 0) ? l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_STARTING) : - WideToUTF16Hack(FormatBytes(size, GetByteDisplayUnits(size), - true)); + FormatBytes(size, GetByteDisplayUnits(size), true); } else { status_text = l10n_util::GetStringFUTF16( IDS_DOWNLOAD_STATUS_IN_PROGRESS, simple_size, simple_total, diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc index e76bf6e..e7f75c9 100644 --- a/chrome/browser/download/download_util.cc +++ b/chrome/browser/download/download_util.cc @@ -591,7 +591,8 @@ std::wstring GetProgressStatusText(DownloadItem* download) { int64 total = download->total_bytes(); int64 size = download->received_bytes(); DataUnits amount_units = GetByteDisplayUnits(size); - std::wstring received_size = FormatBytes(size, amount_units, true); + std::wstring received_size = UTF16ToWideHack(FormatBytes(size, amount_units, + true)); std::wstring amount = received_size; // Adjust both strings for the locale direction since we don't yet know which @@ -604,7 +605,8 @@ std::wstring GetProgressStatusText(DownloadItem* download) { if (total) { amount_units = GetByteDisplayUnits(total); - std::wstring total_text = FormatBytes(total, amount_units, true); + std::wstring total_text = + UTF16ToWideHack(FormatBytes(total, amount_units, true)); std::wstring total_text_localized; if (base::i18n::AdjustStringForLocaleDirection(total_text, &total_text_localized)) @@ -617,8 +619,9 @@ std::wstring GetProgressStatusText(DownloadItem* download) { amount.assign(received_size); } amount_units = GetByteDisplayUnits(download->CurrentSpeed()); - std::wstring speed_text = FormatSpeed(download->CurrentSpeed(), - amount_units, true); + std::wstring speed_text = + UTF16ToWideHack(FormatSpeed(download->CurrentSpeed(), amount_units, + true)); std::wstring speed_text_localized; if (base::i18n::AdjustStringForLocaleDirection(speed_text, &speed_text_localized)) |