Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * 'settings-appearance-page' is the settings page containing appearance | 6 * 'settings-appearance-page' is the settings page containing appearance |
| 7 * settings. | 7 * settings. |
| 8 * | 8 * |
| 9 * Example: | 9 * Example: |
| 10 * | 10 * |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 properties: { | 23 properties: { |
| 24 /** | 24 /** |
| 25 * The current active route. | 25 * The current active route. |
| 26 */ | 26 */ |
| 27 currentRoute: { | 27 currentRoute: { |
| 28 notify: true, | 28 notify: true, |
| 29 type: Object, | 29 type: Object, |
| 30 }, | 30 }, |
| 31 | 31 |
| 32 /** | 32 /** |
| 33 * Preferences state. | |
| 34 */ | |
| 35 prefs: { | |
| 36 type: Object, | |
| 37 notify: true, | |
| 38 }, | |
| 39 | |
| 40 /** | |
| 33 * @private | 41 * @private |
| 34 */ | 42 */ |
| 35 allowResetTheme_: { | 43 allowResetTheme_: { |
| 36 notify: true, | 44 notify: true, |
| 37 type: Boolean, | 45 type: Boolean, |
| 38 value: false, | 46 value: false, |
| 39 }, | 47 }, |
| 40 | 48 |
| 41 /** | 49 /** |
| 50 * @private | |
| 51 */ | |
| 52 defaultZoomLevel_: { | |
| 53 notify: true, | |
| 54 type: Object, | |
| 55 value: function() { | |
| 56 return { | |
| 57 type: chrome.settingsPrivate.PrefType.NUMBER, | |
| 58 }; | |
| 59 }, | |
| 60 }, | |
| 61 | |
| 62 /** | |
| 42 * List of options for the font size drop-down menu. | 63 * List of options for the font size drop-down menu. |
| 43 * The order of entries in this array matches the | 64 * @type {!DropdownMenuOptionList} |
| 44 * prefs.browser.clear_data.time_period.value enum. | |
| 45 * @private {!Array<!Array<{0: number, 1: string}>>} | |
| 46 */ | 65 */ |
| 47 fontSizeOptions_: { | 66 fontSizeOptions_: { |
| 48 readOnly: true, | 67 readOnly: true, |
| 49 type: Array, | 68 type: Array, |
| 50 value: function() { | 69 value: function() { |
| 51 return [ | 70 return [ |
| 52 [9, loadTimeData.getString('verySmall')], | 71 {value: 9, name: loadTimeData.getString('verySmall')}, |
| 53 [12, loadTimeData.getString('small')], | 72 {value: 12, name: loadTimeData.getString('small')}, |
| 54 [16, loadTimeData.getString('medium')], | 73 {value: 16, name: loadTimeData.getString('medium')}, |
| 55 [20, loadTimeData.getString('large')], | 74 {value: 20, name: loadTimeData.getString('large')}, |
| 56 [24, loadTimeData.getString('veryLarge')], | 75 {value: 24, name: loadTimeData.getString('veryLarge')}, |
| 57 ]; | 76 ]; |
| 58 }, | 77 }, |
| 59 }, | 78 }, |
| 79 | |
| 80 /** | |
| 81 * List of options for the page zoom drop-down menu. | |
| 82 * @type {!DropdownMenuOptionList} | |
| 83 */ | |
| 84 pageZoomOptions_: { | |
| 85 readOnly: true, | |
| 86 type: Array, | |
| 87 value: [ | |
| 88 {value: 25, name: '25%'}, | |
| 89 {value: 33, name: '33%'}, | |
| 90 {value: 50, name: '50%'}, | |
| 91 {value: 67, name: '67%'}, | |
| 92 {value: 75, name: '75%'}, | |
| 93 {value: 90, name: '90%'}, | |
| 94 {value: 100, name: '100%'}, | |
| 95 {value: 110, name: '110%'}, | |
| 96 {value: 125, name: '125%'}, | |
| 97 {value: 150, name: '150%'}, | |
| 98 {value: 175, name: '175%'}, | |
| 99 {value: 200, name: '200%'}, | |
| 100 {value: 300, name: '300%'}, | |
| 101 {value: 400, name: '400%'}, | |
| 102 {value: 500, name: '500%'}, | |
| 103 ], | |
| 104 }, | |
| 60 }, | 105 }, |
| 61 | 106 |
| 62 behaviors: [ | 107 behaviors: [ |
| 63 I18nBehavior, | 108 I18nBehavior, |
| 64 ], | 109 ], |
| 65 | 110 |
| 111 observers: [ | |
| 112 'zoomLevelChanged_(defaultZoomLevel_.value)', | |
| 113 ], | |
| 114 | |
| 66 ready: function() { | 115 ready: function() { |
| 67 this.$.defaultFontSize.menuOptions = this.fontSizeOptions_; | 116 this.$.defaultFontSize.menuOptions = this.fontSizeOptions_; |
| 117 this.$.pageZoom.menuOptions = this.pageZoomOptions_; | |
| 118 chrome.settingsPrivate.getDefaultZoomPercent( | |
|
michaelpg
2015/11/21 00:02:28
hmm, won't we need a listener for changes to the d
dschuyler
2015/11/21 01:34:41
Done.
| |
| 119 this.zoomPrefChanged_.bind(this)); | |
| 68 }, | 120 }, |
| 69 | 121 |
| 70 /** @override */ | 122 /** @override */ |
| 71 attached: function() { | 123 attached: function() { |
| 72 // Query the initial state. | 124 // Query the initial state. |
| 73 cr.sendWithCallback('getResetThemeEnabled', undefined, | 125 cr.sendWithCallback('getResetThemeEnabled', undefined, |
| 74 this.setResetThemeEnabled.bind(this)); | 126 this.setResetThemeEnabled.bind(this)); |
| 75 | 127 |
| 76 // Set up the change event listener. | 128 // Set up the change event listener. |
| 77 cr.addWebUIListener('reset-theme-enabled-changed', | 129 cr.addWebUIListener('reset-theme-enabled-changed', |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 92 | 144 |
| 93 /** @private */ | 145 /** @private */ |
| 94 openThemesGallery_: function() { | 146 openThemesGallery_: function() { |
| 95 window.open(loadTimeData.getString('themesGalleryUrl')); | 147 window.open(loadTimeData.getString('themesGalleryUrl')); |
| 96 }, | 148 }, |
| 97 | 149 |
| 98 /** @private */ | 150 /** @private */ |
| 99 resetTheme_: function() { | 151 resetTheme_: function() { |
| 100 chrome.send('resetTheme'); | 152 chrome.send('resetTheme'); |
| 101 }, | 153 }, |
| 154 | |
| 155 /** | |
| 156 * @param {number} percent The integer percentage of the page zoom. | |
| 157 * @private | |
| 158 */ | |
| 159 zoomPrefChanged_: function(percent) { | |
| 160 this.set('defaultZoomLevel_.value', percent); | |
| 161 }, | |
| 162 | |
| 163 /** | |
| 164 * @param {number} percent The integer percentage of the page zoom. | |
| 165 * @private | |
| 166 */ | |
| 167 zoomLevelChanged_: function(percent) { | |
| 168 // The |percent| may be undefined on startup. | |
| 169 if (percent === undefined) | |
| 170 return; | |
| 171 chrome.settingsPrivate.setDefaultZoomPercent(percent); | |
| 172 }, | |
| 102 }); | 173 }); |
| OLD | NEW |