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

Unified Diff: chrome/browser/resources/settings/site_settings/website_usage_private_api.js

Issue 1661533002: Implement deletion of storage per site. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback Created 4 years, 10 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/settings/site_settings/website_usage_private_api.js
diff --git a/chrome/browser/resources/settings/site_settings/website_usage_private_api.js b/chrome/browser/resources/settings/site_settings/website_usage_private_api.js
index 99f8858b0ba25bbe447f6f3eda66c47fceb41201..44fe5f2140bd59211aa404d0a5ee3d0872e803e4 100644
--- a/chrome/browser/resources/settings/site_settings/website_usage_private_api.js
+++ b/chrome/browser/resources/settings/site_settings/website_usage_private_api.js
@@ -16,6 +16,14 @@ Polymer({
type: String,
notify: true,
},
+
+ /**
+ * The type of data used by the given website.
+ */
+ websiteStorageType: {
+ type: Number,
+ notify: true,
+ },
},
attached: function() {
@@ -26,6 +34,15 @@ Polymer({
fetchUsageTotal: function(host) {
settings.WebsiteUsagePrivateApi.fetchUsageTotal(host);
},
+
+ /** @param {string} origin */
michaelpg 2016/02/04 19:18:01 add type param
+ clearUsage: function(origin, type) {
+ settings.WebsiteUsagePrivateApi.clearUsage(origin, type);
+ },
+
+ notifyUsageDeleted: function(origin) {
michaelpg 2016/02/04 19:18:01 nit: @param
+ this.fire('usage-deleted', {origin: origin});
+ },
});
})();
@@ -60,17 +77,43 @@ cr.define('settings.WebsiteUsagePrivateApi', function() {
* @param {string} host The host that the usage was fetched for.
* @param {string} usage The string showing how much data the given host
* is using.
+ * @param {number} type The storage type.
*/
- var returnUsageTotal = function(host, usage) {
+ var returnUsageTotal = function(host, usage, type) {
var instance = settings.WebsiteUsagePrivateApi.websiteUsagePolymerInstance;
if (instance == null)
return;
- if (hostName_ == host)
+ if (hostName_ == host) {
instance.websiteDataUsage = usage;
+ instance.websiteStorageType = type;
+ }
+ };
+
+ /**
+ * Deletes the storage being used for a given origin.
+ * @param {string} origin The origin to delete storage for.
+ * @param {number} type The type of storage to delete.
+ */
+ var clearUsage = function(origin, type) {
+ chrome.send('clearUsage', [origin, type]);
+ };
+
+ /**
+ * Callback for when the usage has been cleared.
+ * @param {string} origin The origin that the usage was fetched for.
+ */
+ var onUsageCleared = function(origin) {
+ var instance = settings.WebsiteUsagePrivateApi.websiteUsagePolymerInstance;
+ if (instance == null)
+ return;
+
+ instance.notifyUsageDeleted(origin);
};
return { websiteUsagePolymerInstance: websiteUsagePolymerInstance,
fetchUsageTotal: fetchUsageTotal,
- returnUsageTotal: returnUsageTotal };
+ returnUsageTotal: returnUsageTotal,
+ clearUsage: clearUsage,
+ onUsageCleared: onUsageCleared, };
});

Powered by Google App Engine
This is Rietveld 408576698