| Index: chrome/browser/resources/settings/site_settings/zoom_levels.js
|
| diff --git a/chrome/browser/resources/settings/site_settings/zoom_levels.js b/chrome/browser/resources/settings/site_settings/zoom_levels.js
|
| index 8d11ef325feb2072cb0e0add94f2f05439a89599..926e4851f7f728319bd97311e0215a048c54d66a 100644
|
| --- a/chrome/browser/resources/settings/site_settings/zoom_levels.js
|
| +++ b/chrome/browser/resources/settings/site_settings/zoom_levels.js
|
| @@ -5,29 +5,55 @@
|
| /**
|
| * @fileoverview
|
| * 'zoom-levels' is the polymer element for showing the sites that are zoomed in
|
| - * or out.
|
| + * or out as well as the zoom scope setting.
|
| */
|
|
|
| Polymer({
|
| is: 'zoom-levels',
|
|
|
| - behaviors: [SiteSettingsBehavior, WebUIListenerBehavior],
|
| + behaviors: [I18nBehavior, SiteSettingsBehavior, WebUIListenerBehavior],
|
|
|
| properties: {
|
| /**
|
| + * Whether zoom changes are applied on a per-site basis or a per-tab basis.
|
| + * @type {boolean}
|
| + */
|
| + zoomScopeIsPerOrigin_: {
|
| + type: Boolean,
|
| + value: true,
|
| + },
|
| +
|
| + /**
|
| * Array of sites that are zoomed in or out.
|
| * @type {!Array<ZoomLevelEntry>}
|
| */
|
| sites_: Array,
|
| +
|
| + /** @private */
|
| + isGuest_: {
|
| + type: Boolean,
|
| + value: function() { return loadTimeData.getBoolean('isGuest'); }
|
| + },
|
| },
|
|
|
| ready: function() {
|
| + this.addWebUIListener('onZoomScopeChanged',
|
| + this.onZoomScopeChanged_.bind(this));
|
| this.addWebUIListener('onZoomLevelsChanged',
|
| this.onZoomLevelsChanged_.bind(this));
|
| + this.browserProxy.fetchZoomScope();
|
| this.browserProxy.fetchZoomLevels();
|
| },
|
|
|
| /**
|
| + * A handler for when the zoom scope changes.
|
| + * @param {boolean} zoomScopeIsPerOrigin The zoom scope setting.
|
| + */
|
| + onZoomScopeChanged_: function(zoomScopeIsPerOrigin) {
|
| + this.zoomScopeIsPerOrigin_ = zoomScopeIsPerOrigin;
|
| + },
|
| +
|
| + /**
|
| * A handler for when zoom levels change.
|
| * @param {!Array<ZoomLevelEntry>} sites The up to date list of sites and
|
| * their zoom levels.
|
| @@ -37,6 +63,31 @@ Polymer({
|
| },
|
|
|
| /**
|
| + * Returns the label for the zoom scope toggle.
|
| + * @private
|
| + */
|
| + getScopeLabel_: function(zoomScopeIsPerOrigin) {
|
| + return zoomScopeIsPerOrigin ? this.i18n('siteSettingsZoomScopeOrigin')
|
| + : this.i18n('siteSettingsZoomScopeTab');
|
| + },
|
| +
|
| + /**
|
| + * Whether to show the text indicating that there are no zoomed sites.
|
| + * @private
|
| + */
|
| + showNoZoomedSites_: function(renderedCount, zoomScopeIsPerOrigin) {
|
| + return renderedCount == 0 && zoomScopeIsPerOrigin;
|
| + },
|
| +
|
| + /**
|
| + * A handler for when the user toggles the zoom scope.
|
| + * @private
|
| + */
|
| + toggleZoomScope_: function() {
|
| + this.browserProxy.setZoomScopeIsPerOrigin(this.zoomScopeIsPerOrigin_);
|
| + },
|
| +
|
| + /**
|
| * A handler for when a zoom level for a site is deleted.
|
| * @param {!{model: !{index: number}}} event
|
| * @private
|
|
|