Chromium Code Reviews| Index: chrome/browser/ui/webui/options/chromeos/storage_manager_handler.cc |
| diff --git a/chrome/browser/ui/webui/options/chromeos/storage_manager_handler.cc b/chrome/browser/ui/webui/options/chromeos/storage_manager_handler.cc |
| index 34afd551778dd2b6436b76aa642e00b76d625da4..950e8aceb3f0f6446a0f312c5f7551c92f955905 100644 |
| --- a/chrome/browser/ui/webui/options/chromeos/storage_manager_handler.cc |
| +++ b/chrome/browser/ui/webui/options/chromeos/storage_manager_handler.cc |
| @@ -33,6 +33,12 @@ void GetSizeStatOnBlockingPool(const base::FilePath& mount_path, |
| *available_size = size; |
| } |
| +// Threshold to show a message indicatiog space is critically low (512 MB). |
|
Dan Beam
2016/06/21 01:39:56
indicatiog -> indicating
fukino
2016/06/21 22:21:50
Done.
|
| +const int64_t kSpaceCriticallyLowBytes = 512LL << 20; |
|
Dan Beam
2016/06/21 01:39:56
512 * 1024 * 1024
would probably be more explana
fukino
2016/06/21 22:21:49
Done.
|
| + |
| +// Threshold to show a message indicatiog space is low (1 GB). |
| +const int64_t kSpaceLowBytes = 1LL << 30; |
|
Dan Beam
2016/06/21 01:39:56
same here:
1 * 1024 * 1024 * 1024
fukino
2016/06/21 22:21:49
Done.
|
| + |
| } // namespace |
| StorageManagerHandler::StorageManagerHandler() : weak_ptr_factory_(this) { |
| @@ -66,6 +72,24 @@ void StorageManagerHandler::GetLocalizedValues( |
| localized_strings->SetString( |
| "storageSizeCalculating", l10n_util::GetStringUTF16( |
| IDS_OPTIONS_SETTINGS_STORAGE_SIZE_CALCULATING)); |
| + localized_strings->SetString( |
| + "storageLowMessageTitle", l10n_util::GetStringUTF16( |
| + IDS_OPTIONS_SETTINGS_STORAGE_SPACE_LOW_MESSAGE_TITLE)); |
| + localized_strings->SetString( |
| + "storageLowMessageLine1", l10n_util::GetStringUTF16( |
| + IDS_OPTIONS_SETTINGS_STORAGE_SPACE_LOW_MESSAGE_LINE_1)); |
| + localized_strings->SetString( |
| + "storageLowMessageLine2", l10n_util::GetStringUTF16( |
| + IDS_OPTIONS_SETTINGS_STORAGE_SPACE_LOW_MESSAGE_LINE_2)); |
| + localized_strings->SetString( |
| + "storageCriticallyLowMessageTitle", l10n_util::GetStringUTF16( |
| + IDS_OPTIONS_SETTINGS_STORAGE_SPACE_CRITICALLY_LOW_MESSAGE_TITLE)); |
| + localized_strings->SetString( |
| + "storageCriticallyLowMessageLine1", l10n_util::GetStringUTF16( |
| + IDS_OPTIONS_SETTINGS_STORAGE_SPACE_CRITICALLY_LOW_MESSAGE_LINE_1)); |
| + localized_strings->SetString( |
| + "storageCriticallyLowMessageLine2", l10n_util::GetStringUTF16( |
| + IDS_OPTIONS_SETTINGS_STORAGE_SPACE_CRITICALLY_LOW_MESSAGE_LINE_2)); |
| } |
| void StorageManagerHandler::InitializePage() { |
| @@ -141,6 +165,9 @@ void StorageManagerHandler::OnGetSizeStat(int64_t* total_size, |
| size_stat.SetString("usedSize", ui::FormatBytes(used_size)); |
| size_stat.SetDouble("usedRatio", |
| static_cast<double>(used_size) / *total_size); |
| + size_stat.SetBoolean("isSpaceLow", *available_size < kSpaceLowBytes); |
|
Dan Beam
2016/06/21 01:39:56
nit: maybe make an enum?
fukino
2016/06/21 22:21:49
Done.
|
| + size_stat.SetBoolean("isSpaceCriticallyLow", |
| + *available_size < kSpaceCriticallyLowBytes); |
| web_ui()->CallJavascriptFunctionUnsafe( |
| "options.StorageManager.setSizeStat", size_stat); |
| } |