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

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: review changes 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
« no previous file with comments | « no previous file | chrome/browser/resources/settings/site_settings/site_list.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+ }
},
/**
« no previous file with comments | « no previous file | chrome/browser/resources/settings/site_settings/site_list.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698