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 d1022348f905d76d4e0990a72a44009775d96c2e..bae75739f7cb1e34f6920acbd16d6cfb865dd013 100644 |
| --- a/chrome/browser/resources/settings/site_settings/site_details.js |
| +++ b/chrome/browser/resources/settings/site_settings/site_details.js |
| @@ -14,12 +14,12 @@ Polymer({ |
| properties: { |
| /** |
| - * The site that this widget is showing details for. |
| - * @type {SiteException} |
| + * The origin that this widget is showing details for. |
| + * @private |
| */ |
| - site: { |
|
raymes
2017/06/19 04:13:12
site looks like it may be referred to in the .html
Patti Lor
2017/06/20 08:25:54
Oops, you're right, thank you. I just removed it,
|
| - type: Object, |
| - observer: 'onSiteChanged_', |
| + origin: { |
| + type: String, |
| + observer: 'onOriginChanged_', |
| }, |
| /** |
| @@ -59,21 +59,27 @@ 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() { |
| - // 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); |
| + onOriginChanged_: function() { |
| + 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'), |
| + function(element) { |
| + this.browserProxy |
| + .getCategoryPermissionForOrigin( |
| + element.category, this.origin, this.origin) |
| + .then(function(permissionResult) { |
| + element.site = element.expandSiteException(permissionResult); |
| + }.bind(element)); |
| + }.bind(this)); |
| }, |
| /** @private */ |
| @@ -89,8 +95,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 +104,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 +113,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_(); |
| } |