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

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: Use svg. 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
« no previous file with comments | « chrome/browser/ui/webui/options/chromeos/storage_manager_handler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 d8214542295d0f302e500b5faf02ec2891c37112..c847ac7f4d035b70d8b876cf579e8fa86153b386 100644
--- a/chrome/browser/ui/webui/options/chromeos/storage_manager_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/storage_manager_handler.cc
@@ -35,6 +35,12 @@ void GetSizeStatOnBlockingPool(const base::FilePath& mount_path,
*available_size = size;
}
+// Threshold to show a message indicating space is critically low (512 MB).
+const int64_t kSpaceCriticallyLowBytes = 512 * 1024 * 1024;
+
+// Threshold to show a message indicating space is low (1 GB).
+const int64_t kSpaceLowBytes = 1 * 1024 * 1024 * 1024;
+
} // namespace
StorageManagerHandler::StorageManagerHandler() : weak_ptr_factory_(this) {
@@ -79,6 +85,24 @@ void StorageManagerHandler::GetLocalizedValues(
localized_strings->SetString(
"storageDeleteAllButtonTitle", l10n_util::GetStringUTF16(
IDS_OPTIONS_SETTINGS_STORAGE_DELETE_ALL_BUTTON_TITLE));
+ 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() {
@@ -169,6 +193,13 @@ 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);
+ int storage_space_state = STORAGE_SPACE_NORMAL;
+ if (*available_size < kSpaceCriticallyLowBytes)
+ storage_space_state = STORAGE_SPACE_CRITICALLY_LOW;
+ else if (*available_size < kSpaceLowBytes)
+ storage_space_state = STORAGE_SPACE_LOW;
+ size_stat.SetInteger("spaceState", storage_space_state);
+
web_ui()->CallJavascriptFunctionUnsafe(
"options.StorageManager.setSizeStat", size_stat);
}
« no previous file with comments | « chrome/browser/ui/webui/options/chromeos/storage_manager_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698