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

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

Issue 7189076: Localize strings, speeds. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: copyright dates Created 9 years, 6 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 9eae34f1c27bf1355d338d456f6eabd8b2119b37..f37cb1fd35ec217fd560d70b9c2734956e33bc28 100644
--- a/chrome/browser/download/download_item_model.cc
+++ b/chrome/browser/download/download_item_model.cc
@@ -13,6 +13,7 @@
#include "chrome/common/time_format.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
+#include "ui/base/text/bytes_formatting.h"
using base::TimeDelta;
@@ -31,8 +32,8 @@ string16 DownloadItemModel::GetStatusText() {
int64 size = download_->received_bytes();
int64 total = download_->total_bytes();
- DataUnits amount_units = GetByteDisplayUnits(total);
- const string16 simple_size = FormatBytes(size, amount_units, false);
+ ui::DataUnits amount_units = ui::GetByteDisplayUnits(total);
+ string16 simple_size = ui::FormatBytesWithUnits(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
@@ -40,7 +41,7 @@ string16 DownloadItemModel::GetStatusText() {
// 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 = base::i18n::GetDisplayStringInLTRDirectionality(
- FormatBytes(total, amount_units, true));
+ ui::FormatBytesWithUnits(total, amount_units, true));
TimeDelta remaining;
string16 simple_time;
@@ -71,9 +72,9 @@ string16 DownloadItemModel::GetStatusText() {
} else {
if (simple_time.empty()) {
// Instead of displaying "0 B" we keep the "Starting..." string.
- status_text = (size == 0) ?
- l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_STARTING) :
- FormatBytes(size, GetByteDisplayUnits(size), true);
+ status_text = (size == 0)
+ ? l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_STARTING)
+ : ui::FormatBytes(size);
} else {
status_text = l10n_util::GetStringFUTF16(
IDS_DOWNLOAD_STATUS_IN_PROGRESS, simple_size, simple_total,

Powered by Google App Engine
This is Rietveld 408576698