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

Unified Diff: chrome/browser/ui/webui/cookies_tree_model_util.cc

Issue 7387007: Adding usage and quota entry to chrome://settings/cookies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 9 years, 5 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/cookies_tree_model_util.cc
diff --git a/chrome/browser/ui/webui/cookies_tree_model_util.cc b/chrome/browser/ui/webui/cookies_tree_model_util.cc
index ac744b49e1e1ac5222a38dc77e0864ff30ec5309..74e295660a8b6493bc3e1dd79da6c072a2daeb8d 100644
--- a/chrome/browser/ui/webui/cookies_tree_model_util.cc
+++ b/chrome/browser/ui/webui/cookies_tree_model_util.cc
@@ -41,6 +41,11 @@ static const char kKeyModified[] = "modified";
static const char kKeyPersistent[] = "persistent";
static const char kKeyTemporary[] = "temporary";
+static const char kKeyTotalUsage[] = "totalUsage";
+static const char kKeyTemporaryUsage[] = "temporaryUsage";
+static const char kKeyPersistentUsage[] = "persistentUsage";
+static const char kKeyPersistentQuota[] = "persistentQuota";
+
// Encodes a pointer value into a hex string.
std::string PointerToHexString(const void* pointer) {
return base::HexEncode(&pointer, sizeof(pointer));
@@ -190,6 +195,39 @@ void GetCookieTreeNodeDictionary(const CookieTreeNode& node,
IDS_COOKIES_FILE_SYSTEM_USAGE_NONE));
break;
}
+ case CookieTreeNode::DetailedInfo::TYPE_QUOTA: {
+ dict->SetString(kKeyType, "quota");
+ dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON");
+
+ const BrowsingDataQuotaHelper::QuotaInfo& quota_info =
+ *node.GetDetailedInfo().quota_info;
+
+ dict->SetString(kKeyOrigin, quota_info.host);
+
+ if (quota_info.temporary_usage >= 0 && quota_info.persistent_usage >= 0) {
+ dict->SetString(kKeyTotalUsage,
+ UTF16ToUTF8(ui::FormatBytes(
+ quota_info.temporary_usage +
+ quota_info.persistent_usage)));
+ }
+
+ if (quota_info.temporary_usage >= 0) {
+ dict->SetString(kKeyTemporaryUsage,
+ UTF16ToUTF8(ui::FormatBytes(
+ quota_info.temporary_usage)));
+ }
+ if (quota_info.persistent_usage >= 0) {
+ dict->SetString(kKeyPersistentUsage,
+ UTF16ToUTF8(ui::FormatBytes(
+ quota_info.persistent_usage)));
+ }
+ if (quota_info.persistent_quota >= 0) {
+ dict->SetString(kKeyPersistentQuota,
+ UTF16ToUTF8(ui::FormatBytes(
+ quota_info.persistent_quota)));
+ }
+ break;
+ }
default:
#if defined(OS_MACOSX)
dict->SetString(kKeyIcon, "chrome://theme/IDR_BOOKMARK_BAR_FOLDER");

Powered by Google App Engine
This is Rietveld 408576698