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

Unified Diff: chrome/browser/resources/options/website_settings.js

Issue 408493003: Show local storage usage on the Website Settings options page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add caching. Created 6 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/resources/options/website_settings.js
diff --git a/chrome/browser/resources/options/website_settings.js b/chrome/browser/resources/options/website_settings.js
index c43c6fcfe880aba2c630d0da5c78e0ba9eaef1ef..4b5910afa2d609820732a605b7a02c0d5ca4b408 100644
--- a/chrome/browser/resources/options/website_settings.js
+++ b/chrome/browser/resources/options/website_settings.js
@@ -41,7 +41,10 @@ cr.define('options', function() {
$('resourceType').onchange = function() {
var target = event.target;
assert(target.tagName == 'SELECT');
- chrome.send('updateOrigins', [target.value]);
+ if (target.value == 'storage')
+ chrome.send('updateLocalStorage');
+ else
+ chrome.send('updateOrigins', [target.value]);
};
var searchBox = $('website-settings-search-box');
@@ -90,6 +93,23 @@ cr.define('options', function() {
},
/**
+ * Populates the origin list with all origins that are using local storage.
+ * @private
+ */
+ populateLocalStorage_: function(originDict) {
+ var origins = [];
+ Object.keys(originDict).map(function(origin) {
Bernhard Bauer 2014/07/22 08:51:47 map() will return a list containing the return val
Daniel Nishi 2014/07/22 22:30:56 Whoops. Now using map() to assign directly.
+ origins.push({origin: origin,
+ usage: originDict[origin].usage,
+ usage_string: originDict[origin].usageString});
Bernhard Bauer 2014/07/22 08:51:47 Make this usageString as well.
Daniel Nishi 2014/07/22 22:30:56 Done and fixed other locations as well.
+ });
+ origins.sort(function(first, second) {
+ return second.usage - first.usage;
+ });
+ this.originList_.dataModel = new ArrayDataModel(origins);
+ },
+
+ /**
* Handle and delay search query changes.
* @param {!Event} e The event object.
* @private
@@ -107,6 +127,10 @@ cr.define('options', function() {
WebsiteSettingsManager.getInstance().populateOrigins_(originDict);
};
+ WebsiteSettingsManager.populateLocalStorage = function(originDict) {
+ WebsiteSettingsManager.getInstance().populateLocalStorage_(originDict);
+ };
+
// Export
return {
WebsiteSettingsManager: WebsiteSettingsManager

Powered by Google App Engine
This is Rietveld 408576698