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

Unified Diff: chrome/browser/ui/webui/options/chromeos/storage_manager_handler.cc

Issue 2078153002: Storage manager: Add conditional messages for disk low situation and update design. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Load roboto.css if chromeos Created 4 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/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);
}

Powered by Google App Engine
This is Rietveld 408576698