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

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

Issue 5154009: Cleanup AdjustStringForLocaleDirection() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: further fixes Created 10 years, 1 month 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_util.cc
diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc
index c7a261f786158fdbddfdacc02147a1a6a9c62691..2c856be3ceb79dff58248555bc8f11413eadf8a7 100644
--- a/chrome/browser/download/download_util.cc
+++ b/chrome/browser/download/download_util.cc
@@ -544,21 +544,15 @@ std::wstring GetProgressStatusText(DownloadItem* download) {
// Adjust both strings for the locale direction since we don't yet know which
// string we'll end up using for constructing the final progress string.
- std::wstring amount_localized;
- if (base::i18n::AdjustStringForLocaleDirection(amount, &amount_localized)) {
- amount.assign(amount_localized);
- received_size.assign(amount_localized);
- }
+ base::i18n::AdjustStringForLocaleDirection(&amount);
if (total) {
amount_units = GetByteDisplayUnits(total);
std::wstring total_text =
UTF16ToWideHack(FormatBytes(total, amount_units, true));
- std::wstring total_text_localized;
- if (base::i18n::AdjustStringForLocaleDirection(total_text,
- &total_text_localized))
- total_text.assign(total_text_localized);
+ base::i18n::AdjustStringForLocaleDirection(&total_text);
+ base::i18n::AdjustStringForLocaleDirection(&received_size);
amount = l10n_util::GetStringF(IDS_DOWNLOAD_TAB_PROGRESS_SIZE,
received_size,
total_text);
@@ -569,10 +563,7 @@ std::wstring GetProgressStatusText(DownloadItem* download) {
amount_units = GetByteDisplayUnits(current_speed);
std::wstring speed_text = UTF16ToWideHack(FormatSpeed(current_speed,
amount_units, true));
- std::wstring speed_text_localized;
- if (base::i18n::AdjustStringForLocaleDirection(speed_text,
- &speed_text_localized))
- speed_text.assign(speed_text_localized);
+ base::i18n::AdjustStringForLocaleDirection(&speed_text);
base::TimeDelta remaining;
string16 time_remaining;
@@ -582,6 +573,7 @@ std::wstring GetProgressStatusText(DownloadItem* download) {
time_remaining = TimeFormat::TimeRemaining(remaining);
if (time_remaining.empty()) {
+ base::i18n::AdjustStringForLocaleDirection(&amount);
return l10n_util::GetStringF(IDS_DOWNLOAD_TAB_PROGRESS_STATUS_TIME_UNKNOWN,
speed_text, amount);
}

Powered by Google App Engine
This is Rietveld 408576698