diff options
author | mkwst@chromium.org <mkwst@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-27 15:15:33 +0000 |
---|---|---|
committer | mkwst@chromium.org <mkwst@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-27 15:15:33 +0000 |
commit | 18be344829126afbac9fd80d621761c02e2d0586 (patch) | |
tree | b81a44cd428216139dbbfb958250a34f300e14c7 | |
parent | 413a531c103226cd161f04360449fbf56bf71897 (diff) | |
download | chromium_src-18be344829126afbac9fd80d621761c02e2d0586.zip chromium_src-18be344829126afbac9fd80d621761c02e2d0586.tar.gz chromium_src-18be344829126afbac9fd80d621761c02e2d0586.tar.bz2 |
Show basic data about local filesystems via chrome://settings/cookies
BUG=63703
TEST=none
Review URL: http://codereview.chromium.org/6992065
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87021 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/app/generated_resources.grd | 12 | ||||
-rw-r--r-- | chrome/browser/resources/options/cookies_list.js | 13 | ||||
-rw-r--r-- | chrome/browser/ui/webui/cookies_tree_model_util.cc | 31 | ||||
-rw-r--r-- | chrome/browser/ui/webui/options/cookies_view_handler.cc | 6 |
4 files changed, 61 insertions, 1 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 6cf1f84..df1a10a 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -7853,9 +7853,21 @@ Keep your key file in a safe place. You will need it to create new versions of y <message name="IDS_COOKIES_INDEXED_DBS" desc="Label for Indexed Databases (name of an HTML standard)"> Indexed Databases </message> + <message name="IDS_COOKIES_FILE_SYSTEM" desc="The text shown when there is a file system (name of an HTML standard) in the Cookies table"> + File System + </message> <message name="IDS_COOKIES_FILE_SYSTEMS" desc="Label for the folder under which a list of file systems (name of an HTML standard) are displayed"> File Systems </message> + <message name="IDS_COOKIES_FILE_SYSTEM_TEMPORARY_USAGE_LABEL" desc="Label for a temporary file system's disk usage."> + Temporary Storage: + </message> + <message name="IDS_COOKIES_FILE_SYSTEM_PERSISTENT_USAGE_LABEL" desc="Label for a persistent file system's disk usage."> + Persistent Storage: + </message> + <message name="IDS_COOKIES_FILE_SYSTEM_USAGE_NONE" desc="Value displayed when no file system of a particular type exists."> + None + </message> <message name="IDS_COOKIES_LAST_ACCESSED_LABEL" desc="The last access date label"> Last accessed: </message> diff --git a/chrome/browser/resources/options/cookies_list.js b/chrome/browser/resources/options/cookies_list.js index 7567ed9..37a93ff 100644 --- a/chrome/browser/resources/options/cookies_list.js +++ b/chrome/browser/resources/options/cookies_list.js @@ -34,6 +34,9 @@ cr.define('options', function() { 'indexed_db': [ ['origin', 'label_indexed_db_origin'], ['size', 'label_indexed_db_size'], ['modified', 'label_indexed_db_last_modified'] ], + 'file_system': [ ['origin', 'label_file_system_origin'], + ['persistent', 'label_file_system_persistent_usage' ], + ['temporary', 'label_file_system_temporary_usage' ] ], }; const localStrings = new LocalStrings(); @@ -204,7 +207,8 @@ cr.define('options', function() { database: false, localStorage: false, appCache: false, - indexedDb: false + indexedDb: false, + fileSystem: false, }; if (this.origin) this.origin.collectSummaryInfo(info); @@ -219,6 +223,8 @@ cr.define('options', function() { list.push(localStrings.getString('cookie_local_storage')); if (info.appCache) list.push(localStrings.getString('cookie_app_cache')); + if (info.fileSystem) + list.push(localStrings.getString('cookie_file_system')); var text = ''; for (var i = 0; i < list.length; ++i) if (text.length > 0) @@ -416,6 +422,8 @@ cr.define('options', function() { info.appCache = true; else if (this.data.type == 'indexed_db') info.indexedDb = true; + else if (this.data.type == 'file_system') + info.fileSystem = true; } }, @@ -444,6 +452,9 @@ cr.define('options', function() { case 'indexed_db': text = localStrings.getString('cookie_indexed_db'); break; + case 'file_system': + text = localStrings.getString('cookie_file_system'); + break; } var div = item.ownerDocument.createElement('div'); div.className = 'cookie-item'; diff --git a/chrome/browser/ui/webui/cookies_tree_model_util.cc b/chrome/browser/ui/webui/cookies_tree_model_util.cc index cde03bb..438aa2b 100644 --- a/chrome/browser/ui/webui/cookies_tree_model_util.cc +++ b/chrome/browser/ui/webui/cookies_tree_model_util.cc @@ -37,6 +37,9 @@ static const char kKeyCreated[] = "created"; static const char kKeyExpires[] = "expires"; static const char kKeyModified[] = "modified"; +static const char kKeyPersistent[] = "persistent"; +static const char kKeyTemporary[] = "temporary"; + // Encodes a pointer value into a hex string. std::string PointerToHexString(const void* pointer) { return base::HexEncode(&pointer, sizeof(pointer)); @@ -176,6 +179,34 @@ void GetCookieTreeNodeDictionary(const CookieTreeNode& node, break; } + case CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM: { + dict->SetString(kKeyType, "file_system"); + dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON"); + + const BrowsingDataFileSystemHelper::FileSystemInfo& file_system_info = + *node.GetDetailedInfo().file_system_info; + + 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)) : + 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)) : + l10n_util::GetStringUTF8( + IDS_COOKIES_FILE_SYSTEM_USAGE_NONE)); + break; + } default: #if defined(OS_MACOSX) dict->SetString(kKeyIcon, "chrome://theme/IDR_BOOKMARK_BAR_FOLDER"); diff --git a/chrome/browser/ui/webui/options/cookies_view_handler.cc b/chrome/browser/ui/webui/options/cookies_view_handler.cc index 2dc093f..2f3b7d3 100644 --- a/chrome/browser/ui/webui/options/cookies_view_handler.cc +++ b/chrome/browser/ui/webui/options/cookies_view_handler.cc @@ -60,6 +60,12 @@ void CookiesViewHandler::GetLocalizedValues( { "search_cookies", IDS_COOKIES_SEARCH_COOKIES }, { "remove_cookie", IDS_COOKIES_REMOVE_LABEL }, { "remove_all_cookie", IDS_COOKIES_REMOVE_ALL_LABEL }, + { "cookie_file_system", IDS_COOKIES_FILE_SYSTEM }, + { "label_file_system_origin", IDS_COOKIES_LOCAL_STORAGE_ORIGIN_LABEL }, + { "label_file_system_temporary_usage", + IDS_COOKIES_FILE_SYSTEM_TEMPORARY_USAGE_LABEL }, + { "label_file_system_persistent_usage", + IDS_COOKIES_FILE_SYSTEM_PERSISTENT_USAGE_LABEL } }; RegisterStrings(localized_strings, resources, arraysize(resources)); |