| 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 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 properties: { | 22 properties: { |
| 23 /** | 23 /** |
| 24 * The current active route. | 24 * The current active route. |
| 25 */ | 25 */ |
| 26 currentRoute: { | 26 currentRoute: { |
| 27 notify: true, | 27 notify: true, |
| 28 type: Object, | 28 type: Object, |
| 29 }, | 29 }, |
| 30 | 30 |
| 31 /** @private {!settings.AppearanceBrowserProxy} */ |
| 32 browserProxy_: Object, |
| 33 |
| 31 /** | 34 /** |
| 32 * Preferences state. | 35 * Preferences state. |
| 33 */ | 36 */ |
| 34 prefs: { | 37 prefs: { |
| 35 type: Object, | 38 type: Object, |
| 36 notify: true, | 39 notify: true, |
| 37 }, | 40 }, |
| 38 | 41 |
| 39 /** | 42 /** |
| 40 * @private | 43 * @private |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 107 |
| 105 /** @private */ | 108 /** @private */ |
| 106 themeSublabel_: String, | 109 themeSublabel_: String, |
| 107 }, | 110 }, |
| 108 | 111 |
| 109 observers: [ | 112 observers: [ |
| 110 'themeChanged_(prefs.extensions.theme.id.value)', | 113 'themeChanged_(prefs.extensions.theme.id.value)', |
| 111 'zoomLevelChanged_(defaultZoomLevel_.value)', | 114 'zoomLevelChanged_(defaultZoomLevel_.value)', |
| 112 ], | 115 ], |
| 113 | 116 |
| 117 created: function() { |
| 118 this.browserProxy_ = settings.AppearanceBrowserProxyImpl.getInstance(); |
| 119 }, |
| 120 |
| 114 ready: function() { | 121 ready: function() { |
| 115 this.$.defaultFontSize.menuOptions = this.fontSizeOptions_; | 122 this.$.defaultFontSize.menuOptions = this.fontSizeOptions_; |
| 116 this.$.pageZoom.menuOptions = this.pageZoomOptions_; | 123 this.$.pageZoom.menuOptions = this.pageZoomOptions_; |
| 117 // TODO(dschuyler): Look into adding a listener for the | 124 // TODO(dschuyler): Look into adding a listener for the |
| 118 // default zoom percent. | 125 // default zoom percent. |
| 119 chrome.settingsPrivate.getDefaultZoomPercent( | 126 chrome.settingsPrivate.getDefaultZoomPercent( |
| 120 this.zoomPrefChanged_.bind(this)); | 127 this.zoomPrefChanged_.bind(this)); |
| 121 }, | 128 }, |
| 122 | 129 |
| 123 /** @override */ | 130 /** @override */ |
| 124 attached: function() { | 131 attached: function() { |
| 125 // Query the initial state. | 132 // Query the initial state. |
| 126 cr.sendWithPromise('getResetThemeEnabled').then( | 133 this.browserProxy_.getResetThemeEnabled().then( |
| 127 this.setResetThemeEnabled.bind(this)); | 134 this.setResetThemeEnabled.bind(this)); |
| 128 | 135 |
| 129 // Set up the change event listener. | 136 // Set up the change event listener. |
| 130 cr.addWebUIListener('reset-theme-enabled-changed', | 137 cr.addWebUIListener('reset-theme-enabled-changed', |
| 131 this.setResetThemeEnabled.bind(this)); | 138 this.setResetThemeEnabled.bind(this)); |
| 132 }, | 139 }, |
| 133 | 140 |
| 134 /** | 141 /** |
| 135 * @param {boolean} isNtp Whether to use the NTP as the home page. | 142 * @param {boolean} isNtp Whether to use the NTP as the home page. |
| 136 * @param {string} homepage If not using NTP, use this URL. | 143 * @param {string} homepage If not using NTP, use this URL. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 153 /** @private */ | 160 /** @private */ |
| 154 onCustomizeFontsTap_: function() { | 161 onCustomizeFontsTap_: function() { |
| 155 this.$.pages.setSubpageChain(['appearance-fonts']); | 162 this.$.pages.setSubpageChain(['appearance-fonts']); |
| 156 }, | 163 }, |
| 157 | 164 |
| 158 /** @private */ | 165 /** @private */ |
| 159 openThemesGallery_: function() { | 166 openThemesGallery_: function() { |
| 160 window.open(loadTimeData.getString('themesGalleryUrl')); | 167 window.open(loadTimeData.getString('themesGalleryUrl')); |
| 161 }, | 168 }, |
| 162 | 169 |
| 170 <if expr="chromeos"> |
| 171 /** |
| 172 * ChromeOS only. |
| 173 * @private |
| 174 */ |
| 175 openWallpaperManager_: function() { |
| 176 this.browserProxy_.openWallpaperManager(); |
| 177 }, |
| 178 </if> |
| 179 |
| 163 /** @private */ | 180 /** @private */ |
| 164 resetTheme_: function() { | 181 resetTheme_: function() { |
| 165 chrome.send('resetTheme'); | 182 this.browserProxy_.resetTheme(); |
| 166 }, | 183 }, |
| 167 | 184 |
| 168 /** @private */ | 185 /** @private */ |
| 169 showFontsPage_: function() { | 186 showFontsPage_: function() { |
| 170 return this.currentRoute.subpage[0] == 'appearance-fonts'; | 187 return this.currentRoute.subpage[0] == 'appearance-fonts'; |
| 171 }, | 188 }, |
| 172 | 189 |
| 173 /** | 190 /** |
| 174 * @param {string} themeId The theme ID. | 191 * @param {string} themeId The theme ID. |
| 175 * @private | 192 * @private |
| (...skipping 21 matching lines...) Expand all Loading... |
| 197 * @param {number} percent The integer percentage of the page zoom. | 214 * @param {number} percent The integer percentage of the page zoom. |
| 198 * @private | 215 * @private |
| 199 */ | 216 */ |
| 200 zoomLevelChanged_: function(percent) { | 217 zoomLevelChanged_: function(percent) { |
| 201 // The |percent| may be undefined on startup. | 218 // The |percent| may be undefined on startup. |
| 202 if (percent === undefined) | 219 if (percent === undefined) |
| 203 return; | 220 return; |
| 204 chrome.settingsPrivate.setDefaultZoomPercent(percent); | 221 chrome.settingsPrivate.setDefaultZoomPercent(percent); |
| 205 }, | 222 }, |
| 206 }); | 223 }); |
| OLD | NEW |