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

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

Issue 2630583002: Add setting to isolate zoom changes by default. (Closed)
Patch Set: ... and tell closure_compiler. Created 3 years, 10 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 | « chrome/browser/resources/settings/site_settings/zoom_levels.html ('k') | chrome/browser/ui/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « chrome/browser/resources/settings/site_settings/zoom_levels.html ('k') | chrome/browser/ui/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698