| 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 * |
| 11 * <iron-animated-pages> | 11 * <iron-animated-pages> |
| 12 * <settings-appearance-page prefs="{{prefs}}"> | 12 * <settings-appearance-page prefs="{{prefs}}"> |
| 13 * </settings-appearance-page> | 13 * </settings-appearance-page> |
| 14 * ... other pages ... | 14 * ... other pages ... |
| 15 * </iron-animated-pages> | 15 * </iron-animated-pages> |
| 16 */ | 16 */ |
| 17 Polymer({ | 17 Polymer({ |
| 18 is: 'settings-appearance-page', | 18 is: 'settings-appearance-page', |
| 19 | 19 |
| 20 behaviors: [I18nBehavior], |
| 21 |
| 20 properties: { | 22 properties: { |
| 21 /** | 23 /** |
| 22 * The current active route. | 24 * The current active route. |
| 23 */ | 25 */ |
| 24 currentRoute: { | 26 currentRoute: { |
| 25 notify: true, | 27 notify: true, |
| 26 type: Object, | 28 type: Object, |
| 27 }, | 29 }, |
| 28 | 30 |
| 29 /** | 31 /** |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 {value: 110, name: '110%'}, | 94 {value: 110, name: '110%'}, |
| 93 {value: 125, name: '125%'}, | 95 {value: 125, name: '125%'}, |
| 94 {value: 150, name: '150%'}, | 96 {value: 150, name: '150%'}, |
| 95 {value: 175, name: '175%'}, | 97 {value: 175, name: '175%'}, |
| 96 {value: 200, name: '200%'}, | 98 {value: 200, name: '200%'}, |
| 97 {value: 300, name: '300%'}, | 99 {value: 300, name: '300%'}, |
| 98 {value: 400, name: '400%'}, | 100 {value: 400, name: '400%'}, |
| 99 {value: 500, name: '500%'}, | 101 {value: 500, name: '500%'}, |
| 100 ], | 102 ], |
| 101 }, | 103 }, |
| 104 |
| 105 /** @private */ |
| 106 themeSublabel_: String, |
| 102 }, | 107 }, |
| 103 | 108 |
| 104 behaviors: [ | |
| 105 I18nBehavior, | |
| 106 ], | |
| 107 | |
| 108 observers: [ | 109 observers: [ |
| 110 'themeChanged_(prefs.extensions.theme.id.value)', |
| 109 'zoomLevelChanged_(defaultZoomLevel_.value)', | 111 'zoomLevelChanged_(defaultZoomLevel_.value)', |
| 110 ], | 112 ], |
| 111 | 113 |
| 112 ready: function() { | 114 ready: function() { |
| 113 this.$.defaultFontSize.menuOptions = this.fontSizeOptions_; | 115 this.$.defaultFontSize.menuOptions = this.fontSizeOptions_; |
| 114 this.$.pageZoom.menuOptions = this.pageZoomOptions_; | 116 this.$.pageZoom.menuOptions = this.pageZoomOptions_; |
| 115 // TODO(dschuyler): Look into adding a listener for the | 117 // TODO(dschuyler): Look into adding a listener for the |
| 116 // default zoom percent. | 118 // default zoom percent. |
| 117 chrome.settingsPrivate.getDefaultZoomPercent( | 119 chrome.settingsPrivate.getDefaultZoomPercent( |
| 118 this.zoomPrefChanged_.bind(this)); | 120 this.zoomPrefChanged_.bind(this)); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 resetTheme_: function() { | 164 resetTheme_: function() { |
| 163 chrome.send('resetTheme'); | 165 chrome.send('resetTheme'); |
| 164 }, | 166 }, |
| 165 | 167 |
| 166 /** @private */ | 168 /** @private */ |
| 167 showFontsPage_: function() { | 169 showFontsPage_: function() { |
| 168 return this.currentRoute.subpage[0] == 'appearance-fonts'; | 170 return this.currentRoute.subpage[0] == 'appearance-fonts'; |
| 169 }, | 171 }, |
| 170 | 172 |
| 171 /** | 173 /** |
| 174 * @param {string} themeId The theme ID. |
| 175 * @private |
| 176 */ |
| 177 themeChanged_: function(themeId) { |
| 178 if (themeId) { |
| 179 chrome.management.get(themeId, |
| 180 function(info) { |
| 181 this.themeSublabel_ = info.name; |
| 182 }.bind(this)); |
| 183 } else { |
| 184 this.themeSublabel_ = this.i18n('chooseFromWebStore'); |
| 185 } |
| 186 }, |
| 187 |
| 188 /** |
| 172 * @param {number} percent The integer percentage of the page zoom. | 189 * @param {number} percent The integer percentage of the page zoom. |
| 173 * @private | 190 * @private |
| 174 */ | 191 */ |
| 175 zoomPrefChanged_: function(percent) { | 192 zoomPrefChanged_: function(percent) { |
| 176 this.set('defaultZoomLevel_.value', percent); | 193 this.set('defaultZoomLevel_.value', percent); |
| 177 }, | 194 }, |
| 178 | 195 |
| 179 /** | 196 /** |
| 180 * @param {number} percent The integer percentage of the page zoom. | 197 * @param {number} percent The integer percentage of the page zoom. |
| 181 * @private | 198 * @private |
| 182 */ | 199 */ |
| 183 zoomLevelChanged_: function(percent) { | 200 zoomLevelChanged_: function(percent) { |
| 184 // The |percent| may be undefined on startup. | 201 // The |percent| may be undefined on startup. |
| 185 if (percent === undefined) | 202 if (percent === undefined) |
| 186 return; | 203 return; |
| 187 chrome.settingsPrivate.setDefaultZoomPercent(percent); | 204 chrome.settingsPrivate.setDefaultZoomPercent(percent); |
| 188 }, | 205 }, |
| 189 }); | 206 }); |
| OLD | NEW |