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 e5a36d9c90c0591fd5c13176ae51c0b49d8ac8df..7db5cc1e6c855e1eed00558b34c94ce17a072308 100644 |
--- a/chrome/browser/resources/settings/site_settings/site_details.js |
+++ b/chrome/browser/resources/settings/site_settings/site_details.js |
@@ -10,7 +10,7 @@ |
Polymer({ |
is: 'site-details', |
- behaviors: [SiteSettingsBehavior], |
+ behaviors: [SiteSettingsBehavior, settings.RouteObserverBehavior], |
properties: { |
/** |
@@ -45,12 +45,32 @@ Polymer({ |
}, |
/** |
+ * settings.RouteObserverBehavior |
+ * @param {!settings.Route} route |
+ * @protected |
+ */ |
+ currentRouteChanged: function(route) { |
+ var site = settings.getQueryParameters().get('site'); |
+ if (!site) |
+ return; |
+ this.browserProxy.getSiteDetails(site).then(function(siteInfo) { |
+ this.site = siteInfo; |
+ // TODO(dschuyler): set originForDisplay for fetchUsageTotal. |
+ // TODO(dschuyler): set the page title to originForDisplay. |
+ }.bind(this)); |
+ }, |
+ |
+ /** |
* Handler for when the origin changes. |
*/ |
onSiteChanged_: function() { |
- // Using originForDisplay avoids the [*.] prefix that some exceptions use. |
- var url = new URL(this.ensureUrlHasScheme(this.site.originForDisplay)); |
- this.$.usageApi.fetchUsageTotal(url.hostname); |
+ // originForDisplay may be initially undefined if the user follows a direct |
+ // link (URL) to this page. |
+ if (this.site.originForDisplay !== undefined) { |
+ // Using originForDisplay avoids the [*.] prefix that some exceptions use. |
+ var url = new URL(this.ensureUrlHasScheme(this.site.originForDisplay)); |
+ this.$.usageApi.fetchUsageTotal(url.hostname); |
Finnur
2016/09/15 12:51:11
So, this code runs, for example, on refresh of Sit
dschuyler
2016/09/15 20:35:27
It /will/ do so after the originForDisplay is set,
|
+ } |
}, |
/** |