diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-22 20:40:22 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-22 20:40:22 +0000 |
commit | 7a3b263af6356885628add7a8843a40dbee5b8ab (patch) | |
tree | eff6140c44d29b6904b90366df65161364ea555f /chrome | |
parent | efaba4815ff6786082583393ad06f8c22ef11fa0 (diff) | |
download | chromium_src-7a3b263af6356885628add7a8843a40dbee5b8ab.zip chromium_src-7a3b263af6356885628add7a8843a40dbee5b8ab.tar.gz chromium_src-7a3b263af6356885628add7a8843a40dbee5b8ab.tar.bz2 |
Localize strings, speeds.
BUG=86527
TEST=run in non-English. For European languages, during a download the decimal separators should be commas (e.g. "0,0 MB"). (The speeds are in strings files and might take a little time to run through the translation machinery.)
Review URL: http://codereview.chromium.org/7189076
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90092 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/chromeos/cros/network_library.cc | 17 | ||||
-rw-r--r-- | chrome/browser/diagnostics/recon_diagnostics.cc | 7 | ||||
-rw-r--r-- | chrome/browser/download/download_item_model.cc | 13 | ||||
-rw-r--r-- | chrome/browser/download/download_manager_unittest.cc | 8 | ||||
-rw-r--r-- | chrome/browser/download/download_util.cc | 10 | ||||
-rw-r--r-- | chrome/browser/task_manager/task_manager.cc | 24 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/content_settings/cookie_details.mm | 23 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/gtk_chrome_cookie_view.cc | 28 | ||||
-rw-r--r-- | chrome/browser/ui/views/appcache_info_view.cc | 3 | ||||
-rw-r--r-- | chrome/browser/ui/views/database_info_view.cc | 6 | ||||
-rw-r--r-- | chrome/browser/ui/views/database_open_info_view.cc | 5 | ||||
-rw-r--r-- | chrome/browser/ui/views/indexed_db_info_view.cc | 6 | ||||
-rw-r--r-- | chrome/browser/ui/views/local_storage_info_view.cc | 6 | ||||
-rw-r--r-- | chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.cc | 4 | ||||
-rw-r--r-- | chrome/browser/ui/webui/cookies_tree_model_util.cc | 35 |
15 files changed, 77 insertions, 118 deletions
diff --git a/chrome/browser/chromeos/cros/network_library.cc b/chrome/browser/chromeos/cros/network_library.cc index 03ad81b..2a4ac3c 100644 --- a/chrome/browser/chromeos/cros/network_library.cc +++ b/chrome/browser/chromeos/cros/network_library.cc @@ -28,6 +28,7 @@ #include "crypto/nss_util.h" // crypto::GetTPMTokenInfo() for 802.1X and VPN. #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/text/bytes_formatting.h" //////////////////////////////////////////////////////////////////////////////// // Implementation notes. @@ -1530,17 +1531,13 @@ string16 CellularDataPlan::GetPlanDesciption() const { case chromeos::CELLULAR_DATA_PLAN_METERED_PAID: { return l10n_util::GetStringFUTF16( IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PURCHASE_DATA, - FormatBytes(plan_data_bytes, - GetByteDisplayUnits(plan_data_bytes), - true), + ui::FormatBytes(plan_data_bytes), base::TimeFormatFriendlyDate(plan_start_time)); } case chromeos::CELLULAR_DATA_PLAN_METERED_BASE: { return l10n_util::GetStringFUTF16( IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_RECEIVED_FREE_DATA, - FormatBytes(plan_data_bytes, - GetByteDisplayUnits(plan_data_bytes), - true), + ui::FormatBytes(plan_data_bytes), base::TimeFormatFriendlyDate(plan_start_time)); default: break; @@ -1576,14 +1573,10 @@ string16 CellularDataPlan::GetDataRemainingDesciption() const { IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_UNLIMITED); } case chromeos::CELLULAR_DATA_PLAN_METERED_PAID: { - return FormatBytes(remaining_bytes, - GetByteDisplayUnits(remaining_bytes), - true); + return ui::FormatBytes(remaining_bytes); } case chromeos::CELLULAR_DATA_PLAN_METERED_BASE: { - return FormatBytes(remaining_bytes, - GetByteDisplayUnits(remaining_bytes), - true); + return ui::FormatBytes(remaining_bytes); } default: break; diff --git a/chrome/browser/diagnostics/recon_diagnostics.cc b/chrome/browser/diagnostics/recon_diagnostics.cc index 390d2aa..77bc6fb 100644 --- a/chrome/browser/diagnostics/recon_diagnostics.cc +++ b/chrome/browser/diagnostics/recon_diagnostics.cc @@ -20,6 +20,7 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_version_info.h" #include "content/common/json_value_serializer.h" +#include "ui/base/text/bytes_formatting.h" #if defined(OS_WIN) #include "base/win/windows_version.h" @@ -251,8 +252,7 @@ class PathTest : public DiagnosticTest { dir_or_file.LossyDisplayName()); return true; } - DataUnits units = GetByteDisplayUnits(dir_or_file_size); - string16 printable_size = FormatBytes(dir_or_file_size, units, true); + string16 printable_size = ui::FormatBytes(dir_or_file_size); if (path_info_.max_size > 0) { if (dir_or_file_size > path_info_.max_size) { @@ -299,8 +299,7 @@ class DiskSpaceTest : public DiagnosticTest { RecordFailure(ASCIIToUTF16("Unable to query free space")); return true; } - DataUnits units = GetByteDisplayUnits(disk_space); - string16 printable_size = FormatBytes(disk_space, units, true); + string16 printable_size = ui::FormatBytes(disk_space); if (disk_space < 80 * kOneMeg) { RecordFailure(ASCIIToUTF16("Low disk space : ") + printable_size); return true; diff --git a/chrome/browser/download/download_item_model.cc b/chrome/browser/download/download_item_model.cc index 9eae34f..f37cb1f 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, diff --git a/chrome/browser/download/download_manager_unittest.cc b/chrome/browser/download/download_manager_unittest.cc index 8b6fcfe..1b80445 100644 --- a/chrome/browser/download/download_manager_unittest.cc +++ b/chrome/browser/download/download_manager_unittest.cc @@ -33,6 +33,7 @@ #include "testing/gmock_mutant.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/text/bytes_formatting.h" class DownloadManagerTest : public testing::Test { public: @@ -447,10 +448,11 @@ TEST_F(DownloadManagerTest, DownloadInterruptTest) { EXPECT_FALSE(observer->was_opened()); EXPECT_FALSE(download->file_externally_removed()); EXPECT_EQ(DownloadItem::INTERRUPTED, download->state()); - DataUnits amount_units = GetByteDisplayUnits(kTestDataLen); - const string16 simple_size = FormatBytes(error_size, amount_units, false); + ui::DataUnits amount_units = ui::GetByteDisplayUnits(kTestDataLen); + string16 simple_size = + ui::FormatBytesWithUnits(error_size, amount_units, false); string16 simple_total = base::i18n::GetDisplayStringInLTRDirectionality( - FormatBytes(kTestDataLen, amount_units, true)); + ui::FormatBytesWithUnits(kTestDataLen, amount_units, true)); EXPECT_EQ(download_item_model->GetStatusText(), l10n_util::GetStringFUTF16(IDS_DOWNLOAD_STATUS_INTERRUPTED, simple_size, diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc index bce087b..83acdb7 100644 --- a/chrome/browser/download/download_util.cc +++ b/chrome/browser/download/download_util.cc @@ -51,6 +51,7 @@ #include "third_party/skia/include/core/SkShader.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/base/text/bytes_formatting.h" #include "ui/gfx/canvas_skia.h" #include "ui/gfx/image/image.h" #include "ui/gfx/rect.h" @@ -724,8 +725,7 @@ DictionaryValue* CreateDownloadItemValue(DownloadItem* download, int id) { string16 GetProgressStatusText(DownloadItem* download) { int64 total = download->total_bytes(); int64 size = download->received_bytes(); - DataUnits amount_units = GetByteDisplayUnits(size); - string16 received_size = FormatBytes(size, amount_units, true); + string16 received_size = ui::FormatBytes(size); string16 amount = received_size; // Adjust both strings for the locale direction since we don't yet know which @@ -733,8 +733,7 @@ string16 GetProgressStatusText(DownloadItem* download) { base::i18n::AdjustStringForLocaleDirection(&amount); if (total) { - amount_units = GetByteDisplayUnits(total); - string16 total_text = FormatBytes(total, amount_units, true); + string16 total_text = ui::FormatBytes(total); base::i18n::AdjustStringForLocaleDirection(&total_text); base::i18n::AdjustStringForLocaleDirection(&received_size); @@ -745,8 +744,7 @@ string16 GetProgressStatusText(DownloadItem* download) { amount.assign(received_size); } int64 current_speed = download->CurrentSpeed(); - amount_units = GetByteDisplayUnits(current_speed); - string16 speed_text = FormatSpeed(current_speed, amount_units, true); + string16 speed_text = ui::FormatSpeed(current_speed); base::i18n::AdjustStringForLocaleDirection(&speed_text); base::TimeDelta remaining; diff --git a/chrome/browser/task_manager/task_manager.cc b/chrome/browser/task_manager/task_manager.cc index 35c8e96..f568f01 100644 --- a/chrome/browser/task_manager/task_manager.cc +++ b/chrome/browser/task_manager/task_manager.cc @@ -36,6 +36,7 @@ #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/base/text/bytes_formatting.h" #include "unicode/coll.h" #if defined(OS_MACOSX) @@ -63,8 +64,8 @@ int ValueCompare(T value1, T value2) { string16 FormatStatsSize(const WebKit::WebCache::ResourceTypeStat& stat) { return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_CACHE_SIZE_CELL_TEXT, - FormatBytes(stat.size, DATA_UNITS_KIBIBYTE, false), - FormatBytes(stat.liveSize, DATA_UNITS_KIBIBYTE, false)); + ui::FormatBytesWithUnits(stat.size, ui::DATA_UNITS_KIBIBYTE, false), + ui::FormatBytesWithUnits(stat.liveSize, ui::DATA_UNITS_KIBIBYTE, false)); } } // namespace @@ -128,8 +129,7 @@ string16 TaskManagerModel::GetResourceNetworkUsage(int index) const { return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT); if (net_usage == 0) return ASCIIToUTF16("0"); - string16 net_byte = FormatSpeed(net_usage, GetByteDisplayUnits(net_usage), - true); + string16 net_byte = ui::FormatSpeed(net_usage); // Force number string to have LTR directionality. return base::i18n::GetDisplayStringInLTRDirectionality(net_byte); } @@ -237,12 +237,12 @@ string16 TaskManagerModel::GetResourceV8MemoryAllocatedSize( if (!resources_[index]->ReportsV8MemoryStats()) return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT); return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_CACHE_SIZE_CELL_TEXT, - FormatBytes(resources_[index]->GetV8MemoryAllocated(), - DATA_UNITS_KIBIBYTE, - false), - FormatBytes(resources_[index]->GetV8MemoryUsed(), - DATA_UNITS_KIBIBYTE, - false)); + ui::FormatBytesWithUnits(resources_[index]->GetV8MemoryAllocated(), + ui::DATA_UNITS_KIBIBYTE, + false), + ui::FormatBytesWithUnits(resources_[index]->GetV8MemoryUsed(), + ui::DATA_UNITS_KIBIBYTE, + false)); } bool TaskManagerModel::IsResourceFirstInGroup(int index) const { @@ -489,9 +489,9 @@ string16 TaskManagerModel::GetMemCellText(int64 number) const { base::i18n::AdjustStringForLocaleDirection(&str); return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_MEM_CELL_TEXT, str); #else - // System expectation is to show "100 KB", "200 MB", etc. + // System expectation is to show "100 kB", "200 MB", etc. // TODO(thakis): Switch to metric units (as opposed to powers of two). - return FormatBytes(number, GetByteDisplayUnits(number), /*show_units=*/true); + return ui::FormatBytes(number); #endif } diff --git a/chrome/browser/ui/cocoa/content_settings/cookie_details.mm b/chrome/browser/ui/cocoa/content_settings/cookie_details.mm index 6b87412..8b9bd8e 100644 --- a/chrome/browser/ui/cocoa/content_settings/cookie_details.mm +++ b/chrome/browser/ui/cocoa/content_settings/cookie_details.mm @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,6 +9,7 @@ #include "grit/generated_resources.h" #include "chrome/browser/cookies_tree_model.h" #include "ui/base/l10n/l10n_util_mac.h" +#include "ui/base/text/bytes_formatting.h" #include "webkit/appcache/appcache_service.h" #pragma mark Cocoa Cookie Details @@ -156,8 +157,8 @@ canEditExpiration_ = NO; databaseDescription_.reset([base::SysUTF8ToNSString( databaseInfo->description) retain]); - fileSize_.reset([base::SysUTF16ToNSString(FormatBytes(databaseInfo->size, - GetByteDisplayUnits(databaseInfo->size), true)) retain]); + fileSize_.reset([base::SysUTF16ToNSString( + ui::FormatBytes(databaseInfo->size)) retain]); lastModified_.reset([base::SysUTF16ToNSString( base::TimeFormatFriendlyDateAndTime( databaseInfo->last_modified)) retain]); @@ -171,8 +172,8 @@ type_ = kCocoaCookieDetailsTypeTreeLocalStorage; canEditExpiration_ = NO; domain_.reset([base::SysUTF8ToNSString(storageInfo->origin) retain]); - fileSize_.reset([base::SysUTF16ToNSString(FormatBytes(storageInfo->size, - GetByteDisplayUnits(storageInfo->size), true)) retain]); + fileSize_.reset( + [base::SysUTF16ToNSString(ui::FormatBytes(storageInfo->size)) retain]); lastModified_.reset([base::SysUTF16ToNSString( base::TimeFormatFriendlyDateAndTime( storageInfo->last_modified)) retain]); @@ -186,8 +187,8 @@ canEditExpiration_ = NO; manifestURL_.reset([base::SysUTF8ToNSString( appcacheInfo->manifest_url.spec()) retain]); - fileSize_.reset([base::SysUTF16ToNSString(FormatBytes(appcacheInfo->size, - GetByteDisplayUnits(appcacheInfo->size), true)) retain]); + fileSize_.reset([base::SysUTF16ToNSString( + ui::FormatBytes(appcacheInfo->size)) retain]); created_.reset([base::SysUTF16ToNSString( base::TimeFormatFriendlyDateAndTime( appcacheInfo->creation_time)) retain]); @@ -209,8 +210,8 @@ domain_.reset([base::SysUTF8ToNSString(domain) retain]); databaseDescription_.reset( [base::SysUTF16ToNSString(databaseDescription) retain]); - fileSize_.reset([base::SysUTF16ToNSString(FormatBytes(fileSize, - GetByteDisplayUnits(fileSize), true)) retain]); + fileSize_.reset( + [base::SysUTF16ToNSString(ui::FormatBytes(fileSize)) retain]); } return self; } @@ -243,8 +244,8 @@ type_ = kCocoaCookieDetailsTypeTreeIndexedDB; canEditExpiration_ = NO; domain_.reset([base::SysUTF8ToNSString(indexedDBInfo->origin) retain]); - fileSize_.reset([base::SysUTF16ToNSString(FormatBytes(indexedDBInfo->size, - GetByteDisplayUnits(indexedDBInfo->size), true)) retain]); + fileSize_.reset([base::SysUTF16ToNSString( + ui::FormatBytes(indexedDBInfo->size)) retain]); lastModified_.reset([base::SysUTF16ToNSString( base::TimeFormatFriendlyDateAndTime( indexedDBInfo->last_modified)) retain]); diff --git a/chrome/browser/ui/gtk/gtk_chrome_cookie_view.cc b/chrome/browser/ui/gtk/gtk_chrome_cookie_view.cc index a7bac57..e1844ba 100644 --- a/chrome/browser/ui/gtk/gtk_chrome_cookie_view.cc +++ b/chrome/browser/ui/gtk/gtk_chrome_cookie_view.cc @@ -9,6 +9,7 @@ #include "chrome/browser/ui/gtk/gtk_util.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/text/bytes_formatting.h" namespace { @@ -540,10 +541,7 @@ void gtk_chrome_cookie_view_display_database( gtk_entry_set_text(GTK_ENTRY(self->database_description_entry_), database_info.description.c_str()); gtk_entry_set_text(GTK_ENTRY(self->database_size_entry_), - UTF16ToUTF8(FormatBytes( - database_info.size, - GetByteDisplayUnits(database_info.size), - true)).c_str()); + UTF16ToUTF8(ui::FormatBytes(database_info.size)).c_str()); gtk_entry_set_text(GTK_ENTRY(self->database_last_modified_entry_), UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime( database_info.last_modified)).c_str()); @@ -560,10 +558,8 @@ void gtk_chrome_cookie_view_display_local_storage( gtk_entry_set_text(GTK_ENTRY(self->local_storage_origin_entry_), local_storage_info.origin.c_str()); gtk_entry_set_text(GTK_ENTRY(self->local_storage_size_entry_), - UTF16ToUTF8(FormatBytes( - local_storage_info.size, - GetByteDisplayUnits(local_storage_info.size), - true)).c_str()); + UTF16ToUTF8(ui::FormatBytes( + local_storage_info.size)).c_str()); gtk_entry_set_text(GTK_ENTRY(self->local_storage_last_modified_entry_), UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime( local_storage_info.last_modified)).c_str()); @@ -579,10 +575,7 @@ void gtk_chrome_cookie_view_display_app_cache( gtk_entry_set_text(GTK_ENTRY(self->appcache_manifest_entry_), info.manifest_url.spec().c_str()); gtk_entry_set_text(GTK_ENTRY(self->appcache_size_entry_), - UTF16ToUTF8(FormatBytes( - info.size, - GetByteDisplayUnits(info.size), - true)).c_str()); + UTF16ToUTF8(ui::FormatBytes(info.size)).c_str()); gtk_entry_set_text(GTK_ENTRY(self->appcache_created_entry_), UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime( info.creation_time)).c_str()); @@ -601,10 +594,8 @@ void gtk_chrome_cookie_view_display_indexed_db( gtk_entry_set_text(GTK_ENTRY(self->indexed_db_origin_entry_), indexed_db_info.origin.c_str()); gtk_entry_set_text(GTK_ENTRY(self->indexed_db_size_entry_), - UTF16ToUTF8(FormatBytes( - indexed_db_info.size, - GetByteDisplayUnits(indexed_db_info.size), - true)).c_str()); + UTF16ToUTF8(ui::FormatBytes( + indexed_db_info.size)).c_str()); gtk_entry_set_text(GTK_ENTRY(self->indexed_db_last_modified_entry_), UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime( indexed_db_info.last_modified)).c_str()); @@ -642,10 +633,7 @@ void gtk_chrome_cookie_view_display_database_accessed( gtk_entry_set_text(GTK_ENTRY(self->database_accessed_description_entry_), UTF16ToUTF8(display_name).c_str()); gtk_entry_set_text(GTK_ENTRY(self->database_accessed_size_entry_), - UTF16ToUTF8(FormatBytes( - estimated_size, - GetByteDisplayUnits(estimated_size), - true)).c_str()); + UTF16ToUTF8(ui::FormatBytes(estimated_size)).c_str()); SetDatabaseAccessedSensitivity(self, TRUE); } diff --git a/chrome/browser/ui/views/appcache_info_view.cc b/chrome/browser/ui/views/appcache_info_view.cc index 199d256..b4add97 100644 --- a/chrome/browser/ui/views/appcache_info_view.cc +++ b/chrome/browser/ui/views/appcache_info_view.cc @@ -8,6 +8,7 @@ #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "grit/generated_resources.h" +#include "ui/base/text/bytes_formatting.h" namespace { const int kInfoLabelIds[] = { @@ -27,7 +28,7 @@ void AppCacheInfoView::SetAppCacheInfo(const appcache::AppCacheInfo* info) { string16 manifest_url = UTF8ToUTF16(info->manifest_url.spec()); string16 size = - FormatBytes(info->size, GetByteDisplayUnits(info->size), true); + ui::FormatBytes(info->size); string16 creation_date = base::TimeFormatFriendlyDateAndTime(info->creation_time); string16 last_access_date = diff --git a/chrome/browser/ui/views/database_info_view.cc b/chrome/browser/ui/views/database_info_view.cc index 0f0d6e4..8f1e7c2 100644 --- a/chrome/browser/ui/views/database_info_view.cc +++ b/chrome/browser/ui/views/database_info_view.cc @@ -10,6 +10,7 @@ #include "base/utf_string_conversions.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/text/bytes_formatting.h" #include "ui/gfx/color_utils.h" #include "views/controls/label.h" #include "views/controls/textfield/textfield.h" @@ -39,10 +40,7 @@ void DatabaseInfoView::SetDatabaseInfo( l10n_util::GetStringUTF16(IDS_COOKIES_WEB_DATABASE_UNNAMED_NAME)) : UTF8ToWide(database_info.database_name)); description_value_field_->SetText(UTF8ToWide(database_info.description)); - size_value_field_->SetText( - FormatBytes(database_info.size, - GetByteDisplayUnits(database_info.size), - true)); + size_value_field_->SetText(ui::FormatBytes(database_info.size)); last_modified_value_field_->SetText( base::TimeFormatFriendlyDateAndTime(database_info.last_modified)); EnableDatabaseDisplay(true); diff --git a/chrome/browser/ui/views/database_open_info_view.cc b/chrome/browser/ui/views/database_open_info_view.cc index 7bdbbef..4d23a95 100644 --- a/chrome/browser/ui/views/database_open_info_view.cc +++ b/chrome/browser/ui/views/database_open_info_view.cc @@ -7,6 +7,7 @@ #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "grit/generated_resources.h" +#include "ui/base/text/bytes_formatting.h" namespace { const int kInfoLabelIds[] = { @@ -29,9 +30,7 @@ void DatabaseOpenInfoView::SetFields(const std::string& host, const string16& display_name, unsigned long estimated_size) { string16 url = UTF8ToUTF16(host); - string16 size = FormatBytes(estimated_size, - GetByteDisplayUnits(estimated_size), - true); + string16 size = ui::FormatBytes(estimated_size); int row = 0; SetValue(row++, url); SetValue(row++, database_name); diff --git a/chrome/browser/ui/views/indexed_db_info_view.cc b/chrome/browser/ui/views/indexed_db_info_view.cc index 34fd9eb6..d033dca 100644 --- a/chrome/browser/ui/views/indexed_db_info_view.cc +++ b/chrome/browser/ui/views/indexed_db_info_view.cc @@ -10,6 +10,7 @@ #include "base/utf_string_conversions.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/text/bytes_formatting.h" #include "ui/gfx/color_utils.h" #include "views/controls/label.h" #include "views/controls/textfield/textfield.h" @@ -34,10 +35,7 @@ IndexedDBInfoView::~IndexedDBInfoView() { void IndexedDBInfoView::SetIndexedDBInfo( const BrowsingDataIndexedDBHelper::IndexedDBInfo& indexed_db_info) { origin_value_field_->SetText(UTF8ToWide(indexed_db_info.origin)); - size_value_field_->SetText( - FormatBytes(indexed_db_info.size, - GetByteDisplayUnits(indexed_db_info.size), - true)); + size_value_field_->SetText(ui::FormatBytes(indexed_db_info.size)); last_modified_value_field_->SetText( base::TimeFormatFriendlyDateAndTime(indexed_db_info.last_modified)); EnableIndexedDBDisplay(true); diff --git a/chrome/browser/ui/views/local_storage_info_view.cc b/chrome/browser/ui/views/local_storage_info_view.cc index 894d7c9..8bbc580 100644 --- a/chrome/browser/ui/views/local_storage_info_view.cc +++ b/chrome/browser/ui/views/local_storage_info_view.cc @@ -10,6 +10,7 @@ #include "base/utf_string_conversions.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/text/bytes_formatting.h" #include "ui/gfx/color_utils.h" #include "views/controls/label.h" #include "views/controls/textfield/textfield.h" @@ -35,10 +36,7 @@ void LocalStorageInfoView::SetLocalStorageInfo( const BrowsingDataLocalStorageHelper::LocalStorageInfo& local_storage_info) { origin_value_field_->SetText(UTF8ToWide(local_storage_info.origin)); - size_value_field_->SetText( - FormatBytes(local_storage_info.size, - GetByteDisplayUnits(local_storage_info.size), - true)); + size_value_field_->SetText(ui::FormatBytes(local_storage_info.size)); last_modified_value_field_->SetText( base::TimeFormatFriendlyDateAndTime(local_storage_info.last_modified)); EnableLocalStorageDisplay(true); diff --git a/chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.cc b/chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.cc index 61ef476..dabfc2c 100644 --- a/chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.cc +++ b/chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.cc @@ -20,6 +20,7 @@ #include "grit/locale_settings.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" +#include "ui/base/text/bytes_formatting.h" namespace imageburner { @@ -596,8 +597,7 @@ void WebUIHandler::GetProgressTimeLeftText(int message_id, } void WebUIHandler::GetDataSizeText(int64 size, string16* size_text) { - DataUnits size_units = GetByteDisplayUnits(size); - *size_text = FormatBytes(size, size_units, true); + *size_text = ui::FormatBytes(size); base::i18n::AdjustStringForLocaleDirection(size_text); } diff --git a/chrome/browser/ui/webui/cookies_tree_model_util.cc b/chrome/browser/ui/webui/cookies_tree_model_util.cc index 438aa2b..7c8a566 100644 --- a/chrome/browser/ui/webui/cookies_tree_model_util.cc +++ b/chrome/browser/ui/webui/cookies_tree_model_util.cc @@ -12,6 +12,7 @@ #include "chrome/browser/cookies_tree_model.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/text/bytes_formatting.h" namespace { @@ -116,10 +117,7 @@ void GetCookieTreeNodeDictionary(const CookieTreeNode& node, l10n_util::GetStringUTF8(IDS_COOKIES_WEB_DATABASE_UNNAMED_NAME) : database_info.database_name); dict->SetString(kKeyDesc, database_info.description); - dict->SetString(kKeySize, - FormatBytes(database_info.size, - GetByteDisplayUnits(database_info.size), - true)); + dict->SetString(kKeySize, ui::FormatBytes(database_info.size)); dict->SetString(kKeyModified, UTF16ToUTF8( base::TimeFormatFriendlyDateAndTime(database_info.last_modified))); @@ -133,10 +131,7 @@ void GetCookieTreeNodeDictionary(const CookieTreeNode& node, local_storage_info = *node.GetDetailedInfo().local_storage_info; dict->SetString(kKeyOrigin, local_storage_info.origin); - dict->SetString(kKeySize, - FormatBytes(local_storage_info.size, - GetByteDisplayUnits(local_storage_info.size), - true)); + dict->SetString(kKeySize, ui::FormatBytes(local_storage_info.size)); dict->SetString(kKeyModified, UTF16ToUTF8( base::TimeFormatFriendlyDateAndTime( local_storage_info.last_modified))); @@ -151,10 +146,7 @@ void GetCookieTreeNodeDictionary(const CookieTreeNode& node, *node.GetDetailedInfo().appcache_info; dict->SetString(kKeyManifest, appcache_info.manifest_url.spec()); - dict->SetString(kKeySize, - FormatBytes(appcache_info.size, - GetByteDisplayUnits(appcache_info.size), - true)); + dict->SetString(kKeySize, ui::FormatBytes(appcache_info.size)); dict->SetString(kKeyCreated, UTF16ToUTF8( base::TimeFormatFriendlyDateAndTime(appcache_info.creation_time))); dict->SetString(kKeyAccessed, UTF16ToUTF8( @@ -170,10 +162,7 @@ void GetCookieTreeNodeDictionary(const CookieTreeNode& node, *node.GetDetailedInfo().indexed_db_info; dict->SetString(kKeyOrigin, indexed_db_info.origin); - dict->SetString(kKeySize, - FormatBytes(indexed_db_info.size, - GetByteDisplayUnits(indexed_db_info.size), - true)); + dict->SetString(kKeySize, ui::FormatBytes(indexed_db_info.size)); dict->SetString(kKeyModified, UTF16ToUTF8( base::TimeFormatFriendlyDateAndTime(indexed_db_info.last_modified))); @@ -189,20 +178,14 @@ void GetCookieTreeNodeDictionary(const CookieTreeNode& node, dict->SetString(kKeyOrigin, file_system_info.origin.spec()); dict->SetString(kKeyPersistent, file_system_info.has_persistent ? - UTF16ToUTF8(FormatBytes( - file_system_info.usage_persistent, - GetByteDisplayUnits( - file_system_info.usage_persistent), - true)) : + UTF16ToUTF8(ui::FormatBytes( + file_system_info.usage_persistent)) : l10n_util::GetStringUTF8( IDS_COOKIES_FILE_SYSTEM_USAGE_NONE)); dict->SetString(kKeyTemporary, file_system_info.has_temporary ? - UTF16ToUTF8(FormatBytes( - file_system_info.usage_temporary, - GetByteDisplayUnits( - file_system_info.usage_temporary), - true)) : + UTF16ToUTF8(ui::FormatBytes( + file_system_info.usage_temporary)) : l10n_util::GetStringUTF8( IDS_COOKIES_FILE_SYSTEM_USAGE_NONE)); break; |