| Index: chrome/browser/resources/settings/site_settings/site_data_details_subpage.js
|
| diff --git a/chrome/browser/resources/settings/site_settings/site_data_details_subpage.js b/chrome/browser/resources/settings/site_settings/site_data_details_subpage.js
|
| index d7ea49bb4b94fec3d3c5de53d9b100230238b22f..aa31e35a7483b882a54606e4fc6f14dc1f99246a 100644
|
| --- a/chrome/browser/resources/settings/site_settings/site_data_details_subpage.js
|
| +++ b/chrome/browser/resources/settings/site_settings/site_data_details_subpage.js
|
| @@ -5,135 +5,141 @@
|
| (function() {
|
| 'use strict';
|
|
|
| -/**
|
| - * 'site-data-details-subpage' Display cookie contents.
|
| - */
|
| -Polymer({
|
| - is: 'site-data-details-subpage',
|
| + /**
|
| + * 'site-data-details-subpage' Display cookie contents.
|
| + */
|
| + Polymer({
|
| + is: 'site-data-details-subpage',
|
| +
|
| + behaviors: [settings.RouteObserverBehavior, WebUIListenerBehavior],
|
| +
|
| + properties: {
|
| + /**
|
| + * The browser proxy used to retrieve and change cookies.
|
| + * @type {settings.SiteSettingsPrefsBrowserProxy}
|
| + */
|
| + browserProxy: Object,
|
| +
|
| + /**
|
| + * The cookie entries for the given site.
|
| + * @type {!Array<!CookieDataItem>}
|
| + * @private
|
| + */
|
| + entries_: Array,
|
| +
|
| + /** Set the page title on the settings-subpage parent. */
|
| + pageTitle: {
|
| + type: String,
|
| + notify: true,
|
| + },
|
| +
|
| + /** @private */
|
| + site_: String,
|
| +
|
| + /** @private */
|
| + siteId_: String,
|
| + },
|
|
|
| - behaviors: [settings.RouteObserverBehavior, WebUIListenerBehavior],
|
| + /** @override */
|
| + ready: function() {
|
| + this.browserProxy =
|
| + settings.SiteSettingsPrefsBrowserProxyImpl.getInstance();
|
|
|
| - properties: {
|
| - /**
|
| - * The browser proxy used to retrieve and change cookies.
|
| - * @type {settings.SiteSettingsPrefsBrowserProxy}
|
| - */
|
| - browserProxy: Object,
|
| + this.addWebUIListener(
|
| + 'onTreeItemRemoved', this.getCookieDetails_.bind(this));
|
| + },
|
|
|
| /**
|
| - * The cookie entries for the given site.
|
| - * @type {!Array<!CookieDataItem>}
|
| - * @private
|
| + * settings.RouteObserverBehavior
|
| + * @param {!settings.Route} route
|
| + * @protected
|
| */
|
| - entries_: Array,
|
| -
|
| - /** Set the page title on the settings-subpage parent. */
|
| - pageTitle: {
|
| - type: String,
|
| - notify: true,
|
| + currentRouteChanged: function(route) {
|
| + if (settings.getCurrentRoute() !=
|
| + settings.Route.SITE_SETTINGS_DATA_DETAILS)
|
| + return;
|
| + var site = settings.getQueryParameters().get('site');
|
| + if (!site || site == this.site_)
|
| + return;
|
| + this.site_ = site;
|
| + this.pageTitle =
|
| + loadTimeData.getStringF('siteSettingsCookieSubpage', site);
|
| + this.getCookieDetails_();
|
| },
|
|
|
| /** @private */
|
| - site_: String,
|
| -
|
| - /** @private */
|
| - siteId_: String,
|
| - },
|
| -
|
| - /** @override */
|
| - ready: function() {
|
| - this.browserProxy =
|
| - settings.SiteSettingsPrefsBrowserProxyImpl.getInstance();
|
| -
|
| - this.addWebUIListener('onTreeItemRemoved',
|
| - this.getCookieDetails_.bind(this));
|
| - },
|
| -
|
| - /**
|
| - * settings.RouteObserverBehavior
|
| - * @param {!settings.Route} route
|
| - * @protected
|
| - */
|
| - currentRouteChanged: function(route) {
|
| - if (settings.getCurrentRoute() != settings.Route.SITE_SETTINGS_DATA_DETAILS)
|
| - return;
|
| - var site = settings.getQueryParameters().get('site');
|
| - if (!site || site == this.site_)
|
| - return;
|
| - this.site_ = site;
|
| - this.pageTitle = loadTimeData.getStringF('siteSettingsCookieSubpage', site);
|
| - this.getCookieDetails_();
|
| - },
|
| -
|
| - /** @private */
|
| - getCookieDetails_: function() {
|
| - if (!this.site_)
|
| - return;
|
| - this.browserProxy.getCookieDetails(this.site_).then(
|
| - this.onCookiesLoaded_.bind(this),
|
| - this.onCookiesLoadFailed_.bind(this));
|
| - },
|
| + getCookieDetails_: function() {
|
| + if (!this.site_)
|
| + return;
|
| + this.browserProxy.getCookieDetails(this.site_)
|
| + .then(
|
| + this.onCookiesLoaded_.bind(this),
|
| + this.onCookiesLoadFailed_.bind(this));
|
| + },
|
|
|
| - /**
|
| + /**
|
| * @return {!Array<!CookieDataForDisplay>}
|
| * @private
|
| */
|
| - getCookieNodes_: function(node) {
|
| - return getCookieData(node);
|
| - },
|
| + getCookieNodes_: function(node) {
|
| + return getCookieData(node);
|
| + },
|
|
|
| - /**
|
| - * @param {!CookieDataSummaryItem} cookies
|
| - * @private
|
| - */
|
| - onCookiesLoaded_: function(cookies) {
|
| - this.siteId_ = cookies.id;
|
| - this.entries_ = cookies.children;
|
| - // Set up flag for expanding cookie details.
|
| - this.entries_.map(function(e) { return e.expanded_ = false; });
|
| - },
|
| + /**
|
| + * @param {!CookieDataSummaryItem} cookies
|
| + * @private
|
| + */
|
| + onCookiesLoaded_: function(cookies) {
|
| + this.siteId_ = cookies.id;
|
| + this.entries_ = cookies.children;
|
| + // Set up flag for expanding cookie details.
|
| + this.entries_.map(function(e) {
|
| + return e.expanded_ = false;
|
| + });
|
| + },
|
|
|
| - /**
|
| - * The site was not found. E.g. The site data may have been deleted or the
|
| - * site URL parameter may be mistyped.
|
| - * @private
|
| - */
|
| - onCookiesLoadFailed_: function() {
|
| - this.siteId_ = '';
|
| - this.entries_ = [];
|
| - },
|
| + /**
|
| + * The site was not found. E.g. The site data may have been deleted or the
|
| + * site URL parameter may be mistyped.
|
| + * @private
|
| + */
|
| + onCookiesLoadFailed_: function() {
|
| + this.siteId_ = '';
|
| + this.entries_ = [];
|
| + },
|
|
|
| - /**
|
| + /**
|
| * A handler for when the user opts to remove a single cookie.
|
| * @param {!CookieDetails} item
|
| * @return {string}
|
| * @private
|
| */
|
| - getEntryDescription_: function(item) {
|
| - // Frequently there are multiple cookies per site. To avoid showing a list
|
| - // of '1 cookie', '1 cookie', ... etc, it is better to show the title of the
|
| - // cookie to differentiate them.
|
| - if (item.type == 'cookie')
|
| - return item.title;
|
| - return getCookieDataCategoryText(item.type, item.totalUsage);
|
| - },
|
| + getEntryDescription_: function(item) {
|
| + // Frequently there are multiple cookies per site. To avoid showing a list
|
| + // of '1 cookie', '1 cookie', ... etc, it is better to show the title of
|
| + // the
|
| + // cookie to differentiate them.
|
| + if (item.type == 'cookie')
|
| + return item.title;
|
| + return getCookieDataCategoryText(item.type, item.totalUsage);
|
| + },
|
|
|
| - /**
|
| - * A handler for when the user opts to remove a single cookie.
|
| - * @param {!Event} event
|
| - * @private
|
| - */
|
| - onRemove_: function(event) {
|
| - this.browserProxy.removeCookie(
|
| - /** @type {!CookieDetails} */(event.currentTarget.dataset).idPath);
|
| - },
|
| + /**
|
| + * A handler for when the user opts to remove a single cookie.
|
| + * @param {!Event} event
|
| + * @private
|
| + */
|
| + onRemove_: function(event) {
|
| + this.browserProxy.removeCookie(
|
| + /** @type {!CookieDetails} */ (event.currentTarget.dataset).idPath);
|
| + },
|
|
|
| - /**
|
| - * A handler for when the user opts to remove all cookies.
|
| - */
|
| - removeAll: function() {
|
| - this.browserProxy.removeCookie(this.siteId_);
|
| - },
|
| -});
|
| + /**
|
| + * A handler for when the user opts to remove all cookies.
|
| + */
|
| + removeAll: function() {
|
| + this.browserProxy.removeCookie(this.siteId_);
|
| + },
|
| + });
|
|
|
| })();
|
|
|