Chromium Code Reviews| Index: chrome/browser/resources/settings/appearance_page/appearance_page.js |
| diff --git a/chrome/browser/resources/settings/appearance_page/appearance_page.js b/chrome/browser/resources/settings/appearance_page/appearance_page.js |
| index 09a8aad321d529bf652ebfe29e5aec79b0fcb8ba..fc82a3917ec56aaad56eabbd449521d5b540f26d 100644 |
| --- a/chrome/browser/resources/settings/appearance_page/appearance_page.js |
| +++ b/chrome/browser/resources/settings/appearance_page/appearance_page.js |
| @@ -30,6 +30,14 @@ Polymer({ |
| }, |
| /** |
| + * Preferences state. |
| + */ |
| + prefs: { |
| + type: Object, |
| + notify: true, |
| + }, |
| + |
| + /** |
| * @private |
| */ |
| allowResetTheme_: { |
| @@ -39,10 +47,19 @@ Polymer({ |
| }, |
| /** |
| + * @private |
| + */ |
| + defaultZoomLevel_: { |
| + notify: true, |
| + type: Object, |
| + value: function() { |
| + return {value: undefined}; |
| + }, |
| + }, |
| + |
| + /** |
| * List of options for the font size drop-down menu. |
| - * The order of entries in this array matches the |
| - * prefs.browser.clear_data.time_period.value enum. |
| - * @private {!Array<!Array<{0: number, 1: string}>>} |
| + * @type {!DropdownMenuOptionList} |
| */ |
| fontSizeOptions_: { |
| readOnly: true, |
| @@ -57,14 +74,47 @@ Polymer({ |
| ]; |
| }, |
| }, |
| + |
| + /** |
| + * List of options for the page zoom drop-down menu. |
| + * @type {!DropdownMenuOptionList} |
| + */ |
| + pageZoomOptions_: { |
| + readOnly: true, |
| + type: Array, |
| + value: [ |
| + [25, '25%'], |
| + [33, '33%'], |
| + [50, '50%'], |
| + [67, '67%'], |
| + [75, '75%'], |
| + [90, '90%'], |
| + [100, '100%'], |
| + [110, '110%'], |
| + [125, '125%'], |
| + [150, '150%'], |
| + [175, '175%'], |
| + [200, '200%'], |
| + [300, '300%'], |
| + [400, '400%'], |
| + [500, '500%'], |
| + ], |
| + }, |
| }, |
| behaviors: [ |
| I18nBehavior, |
| ], |
| + observers: [ |
| + 'zoomLevelChanged_(defaultZoomLevel_.value)', |
| + ], |
| + |
| ready: function() { |
| this.$.defaultFontSize.menuOptions = this.fontSizeOptions_; |
| + this.$.pageZoom.menuOptions = this.pageZoomOptions_; |
| + chrome.settingsPrivate.getDefaultZoomPercent( |
| + this.zoomPrefChanged_.bind(this)); |
| }, |
| /** @override */ |
| @@ -99,4 +149,23 @@ Polymer({ |
| resetTheme_: function() { |
| chrome.send('resetTheme'); |
| }, |
| + |
| + /** |
| + * @param {number} percent The integer percentage of the page zoom. |
| + * @private |
| + */ |
| + zoomPrefChanged_: function(percent) { |
| + this.set('defaultZoomLevel_.value', percent); |
| + }, |
| + |
| + /** |
| + * @param {number} percent The integer percentage of the page zoom. |
| + * @private |
| + */ |
| + zoomLevelChanged_: function(percent) { |
| + // The |percent| may be undefined on startup. |
|
michaelpg
2015/11/11 02:09:41
This is dumb. FWIW, I consider this a Polymer bug.
|
| + if (percent === undefined) |
| + return; |
| + chrome.settingsPrivate.setDefaultZoomPercent(percent); |
| + }, |
| }); |