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

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

Issue 1607483005: Show data usage on Site Details (MDSettings) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix update problem Created 4 years, 11 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/site_details.js
diff --git a/chrome/browser/resources/settings/site_settings/site_details.js b/chrome/browser/resources/settings/site_settings/site_details.js
index a6a8db7bccd77c5cc7efe83b5ed76db48c90c85d..18b706d5fd160b555fe9c407ee507264406205f1 100644
--- a/chrome/browser/resources/settings/site_settings/site_details.js
+++ b/chrome/browser/resources/settings/site_settings/site_details.js
@@ -31,14 +31,17 @@ Polymer({
/**
* The origin that this widget is showing details for.
*/
- origin: String,
+ origin: {
+ type: String,
+ observer: 'onOriginChanged_',
+ },
/**
* The amount of data stored for the origin.
*/
storedData_: {
type: String,
- observer: 'onStoredDataChanged_',
+ value: '',
},
},
@@ -51,19 +54,26 @@ Polymer({
this.$.fullscreen.category = settings.ContentSettingsTypes.FULLSCREEN;
this.$.camera.category = settings.ContentSettingsTypes.CAMERA;
this.$.mic.category = settings.ContentSettingsTypes.MIC;
-
- this.storedData_ = '1337 MB'; // TODO(finnur): Fetch actual data.
},
- onStoredDataChanged_: function() {
- this.$.usage.hidden = false;
- this.$.storage.hidden = false;
+ /**
+ * Handler for when the origin changes.
+ */
+ onOriginChanged_: function() {
+ var url = /** @type {{hostname: string}} */(new URL(this.origin));
+ this.$.usageApi.fetchUsageTotal(url.hostname);
},
+ /**
+ * Clears all data stored for the current origin.
+ */
onClearStorage_: function() {
// TODO(finnur): Implement.
},
+ /**
+ * Resets all permissions and clears all data stored for the current origin.
+ */
onClearAndReset_: function() {
Array.prototype.forEach.call(
this.root.querySelectorAll('site-details-permission'),

Powered by Google App Engine
This is Rietveld 408576698