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

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

Issue 2338163004: [MD settings] add getSiteDetails to site settings browser proxy (Closed)
Patch Set: added comment Created 4 years, 3 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 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,
+ }
},
/**

Powered by Google App Engine
This is Rietveld 408576698