Chromium Code Reviews| 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..c2a609eb3d8d45882b9df412c975e13d8278b4eb 100644 |
| --- a/chrome/browser/resources/settings/site_settings/site_details.js |
| +++ b/chrome/browser/resources/settings/site_settings/site_details.js |
| @@ -31,15 +31,15 @@ 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_', |
| - }, |
| + storedData_: String, |
| }, |
| ready: function() { |
| @@ -51,19 +51,39 @@ 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. |
| + /** |
| + * Handler for when the origin changes. |
| + */ |
| + onOriginChanged_: function() { |
| + var siteSettingsHandler = new SiteSettingsHandler(); |
| + siteSettingsHandler.fetchUsageTotal( |
| + this.origin, // The origin to fetch usage total for. |
| + this, // The context to use for the callback. |
| + this.OnUsageDataAvailable); // The callback. |
|
michaelpg
2016/01/19 20:47:54
just bind this to |this| instead of passing the |t
Finnur
2016/01/22 15:07:35
Obsolete code now.
|
| }, |
| - onStoredDataChanged_: function() { |
| + /** |
| + * Updates the usage data and shows its header. |
| + * @param {string} usage The amount of data stored for the current origin. |
| + */ |
| + OnUsageDataAvailable: function(usage) { |
|
michaelpg
2016/01/19 20:47:54
camelCase
also, would you mind renaming this? i f
Finnur
2016/01/22 15:07:35
Also obsolete.
|
| + this.storedData_ = usage; |
| this.$.usage.hidden = false; |
| this.$.storage.hidden = false; |
| }, |
| + /** |
| + * 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'), |