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 d1022348f905d76d4e0990a72a44009775d96c2e..ccac618b08f7c0fbc554551d5b281c6c07f90803 100644 |
--- a/chrome/browser/resources/settings/site_settings/site_details.js |
+++ b/chrome/browser/resources/settings/site_settings/site_details.js |
@@ -14,12 +14,11 @@ Polymer({ |
properties: { |
/** |
- * The site that this widget is showing details for. |
- * @type {SiteException} |
+ * The origin that this widget is showing details for. |
*/ |
- site: { |
- type: Object, |
- observer: 'onSiteChanged_', |
+ origin: { |
+ type: String, |
+ observer: 'onOriginChanged_', |
}, |
/** |
@@ -59,21 +58,32 @@ Polymer({ |
var site = settings.getQueryParameters().get('site'); |
if (!site) |
return; |
- this.browserProxy.getSiteDetails(site).then(function(siteInfo) { |
- this.site = this.expandSiteException(siteInfo); |
- }.bind(this)); |
+ this.origin = site; |
}, |
/** |
* Handler for when the origin changes. |
* @private |
*/ |
- onSiteChanged_: function() { |
+ onOriginChanged_: function() { |
// origin may be initially undefined if the user follows a direct |
// link (URL) to this page. |
- var origin = this.site.origin; |
- if (origin !== undefined) |
- this.$.usageApi.fetchUsageTotal(this.toUrl(origin).hostname); |
+ if (this.origin === undefined) |
tsergeant
2017/06/16 03:11:40
This check shouldn't be necessary anymore. Polymer
Patti Lor
2017/06/20 08:25:54
Done.
|
+ return; |
+ |
+ this.$.usageApi.fetchUsageTotal(this.toUrl(this.origin).hostname); |
+ |
+ // Retrieve the setting for each category shown. |
+ Array.prototype.forEach.call( |
+ this.root.querySelectorAll('site-details-permission'), |
tsergeant
2017/06/16 03:11:40
Because it's the future (Chrome 51+), NodeList has
Patti Lor
2017/06/20 08:25:54
Ohh, I was kinda confused about this. Thanks for t
|
+ function(element) { |
+ this.browserProxy |
+ .getCategoryPermissionForOrigin( |
+ element.category, this.origin, this.origin) |
+ .then(function(permission_result) { |
tsergeant
2017/06/16 03:11:39
JS Style uses camelCase rather than snake_case
Patti Lor
2017/06/20 08:25:54
Done.
|
+ element.site = element.expandSiteException(permission_result); |
+ }.bind(element)); |
+ }.bind(this)); |
}, |
/** @private */ |
@@ -89,8 +99,7 @@ Polymer({ |
onConfirmClearStorage_: function(e) { |
e.preventDefault(); |
this.confirmationDeleteMsg_ = loadTimeData.getStringF( |
- 'siteSettingsSiteRemoveConfirmation', |
- this.toUrl(this.site.origin).href); |
+ 'siteSettingsSiteRemoveConfirmation', this.toUrl(this.origin).href); |
this.$.confirmDeleteDialog.showModal(); |
}, |
@@ -99,8 +108,7 @@ Polymer({ |
* @private |
*/ |
onClearStorage_: function() { |
- this.$.usageApi.clearUsage( |
- this.toUrl(this.site.origin).href, this.storageType_); |
+ this.$.usageApi.clearUsage(this.toUrl(this.origin).href, this.storageType_); |
}, |
/** |
@@ -109,7 +117,7 @@ Polymer({ |
* @private |
*/ |
onUsageDeleted_: function(event) { |
- if (event.detail.origin == this.toUrl(this.site.origin).href) { |
+ if (event.detail.origin == this.toUrl(this.origin).href) { |
this.storedData_ = ''; |
this.navigateBackIfNoData_(); |
} |