| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 93 |
| 94 /** @private {?settings.AppearanceBrowserProxy} */ | 94 /** @private {?settings.AppearanceBrowserProxy} */ |
| 95 browserProxy_: null, | 95 browserProxy_: null, |
| 96 | 96 |
| 97 /** @private {string} */ | 97 /** @private {string} */ |
| 98 themeUrl_: '', | 98 themeUrl_: '', |
| 99 | 99 |
| 100 observers: [ | 100 observers: [ |
| 101 'themeChanged_(prefs.extensions.theme.id.value, useSystemTheme_)', | 101 'themeChanged_(prefs.extensions.theme.id.value, useSystemTheme_)', |
| 102 | 102 |
| 103 <if expr="is_linux and not chromeos"> | 103 /* <if expr="is_linux and not chromeos"> */ |
| 104 // NOTE: this pref only exists on Linux. | 104 // NOTE: this pref only exists on Linux. |
| 105 'useSystemThemePrefChanged_(prefs.extensions.theme.use_system.value)', | 105 'useSystemThemePrefChanged_(prefs.extensions.theme.use_system.value)', |
| 106 </if> | 106 /* </if> */ |
| 107 ], | 107 ], |
| 108 | 108 |
| 109 created: function() { | 109 created: function() { |
| 110 this.browserProxy_ = settings.AppearanceBrowserProxyImpl.getInstance(); | 110 this.browserProxy_ = settings.AppearanceBrowserProxyImpl.getInstance(); |
| 111 }, | 111 }, |
| 112 | 112 |
| 113 ready: function() { | 113 ready: function() { |
| 114 this.$.defaultFontSize.menuOptions = this.fontSizeOptions_; | 114 this.$.defaultFontSize.menuOptions = this.fontSizeOptions_; |
| 115 // TODO(dschuyler): Look into adding a listener for the | 115 // TODO(dschuyler): Look into adding a listener for the |
| 116 // default zoom percent. | 116 // default zoom percent. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 /** @private */ | 148 /** @private */ |
| 149 onDisableExtension_: function() { | 149 onDisableExtension_: function() { |
| 150 this.fire('refresh-pref', 'homepage'); | 150 this.fire('refresh-pref', 'homepage'); |
| 151 }, | 151 }, |
| 152 | 152 |
| 153 /** @private */ | 153 /** @private */ |
| 154 onThemesTap_: function() { | 154 onThemesTap_: function() { |
| 155 window.open(this.themeUrl_ || loadTimeData.getString('themesGalleryUrl')); | 155 window.open(this.themeUrl_ || loadTimeData.getString('themesGalleryUrl')); |
| 156 }, | 156 }, |
| 157 | 157 |
| 158 <if expr="chromeos"> | 158 /* <if expr="chromeos"> */ |
| 159 /** | 159 /** |
| 160 * ChromeOS only. | 160 * ChromeOS only. |
| 161 * @private | 161 * @private |
| 162 */ | 162 */ |
| 163 openWallpaperManager_: function() { | 163 openWallpaperManager_: function() { |
| 164 this.browserProxy_.openWallpaperManager(); | 164 this.browserProxy_.openWallpaperManager(); |
| 165 }, | 165 }, |
| 166 </if> | 166 /* </if> */ |
| 167 | 167 |
| 168 /** @private */ | 168 /** @private */ |
| 169 onUseDefaultTap_: function() { | 169 onUseDefaultTap_: function() { |
| 170 this.browserProxy_.useDefaultTheme(); | 170 this.browserProxy_.useDefaultTheme(); |
| 171 }, | 171 }, |
| 172 | 172 |
| 173 <if expr="is_linux and not chromeos"> | 173 /* <if expr="is_linux and not chromeos"> */ |
| 174 /** | 174 /** |
| 175 * @param {boolean} useSystemTheme | 175 * @param {boolean} useSystemTheme |
| 176 * @private | 176 * @private |
| 177 */ | 177 */ |
| 178 useSystemThemePrefChanged_: function(useSystemTheme) { | 178 useSystemThemePrefChanged_: function(useSystemTheme) { |
| 179 this.useSystemTheme_ = useSystemTheme; | 179 this.useSystemTheme_ = useSystemTheme; |
| 180 }, | 180 }, |
| 181 | 181 |
| 182 /** | 182 /** |
| 183 * @param {string} themeId | 183 * @param {string} themeId |
| (...skipping 17 matching lines...) Expand all Loading... |
| 201 | 201 |
| 202 /** | 202 /** |
| 203 * @param {string} themeId | 203 * @param {string} themeId |
| 204 * @param {boolean} useSystemTheme | 204 * @param {boolean} useSystemTheme |
| 205 * @return {boolean} Whether to show the secondary area where "USE CLASSIC" | 205 * @return {boolean} Whether to show the secondary area where "USE CLASSIC" |
| 206 * and "USE GTK+" buttons live. | 206 * and "USE GTK+" buttons live. |
| 207 * @private | 207 * @private |
| 208 */ | 208 */ |
| 209 showThemesSecondary_: function(themeId, useSystemTheme) { | 209 showThemesSecondary_: function(themeId, useSystemTheme) { |
| 210 return this.showUseClassic_(themeId, useSystemTheme) || | 210 return this.showUseClassic_(themeId, useSystemTheme) || |
| 211 this.showUseSystem_(themeId, useSystemTheme); | 211 this.showUseSystem_(themeId, useSystemTheme); |
| 212 }, | 212 }, |
| 213 | 213 |
| 214 /** @private */ | 214 /** @private */ |
| 215 onUseSystemTap_: function() { | 215 onUseSystemTap_: function() { |
| 216 this.browserProxy_.useSystemTheme(); | 216 this.browserProxy_.useSystemTheme(); |
| 217 }, | 217 }, |
| 218 </if> | 218 /* </if> */ |
| 219 | 219 |
| 220 /** | 220 /** |
| 221 * @param {string} themeId | 221 * @param {string} themeId |
| 222 * @param {boolean} useSystemTheme | 222 * @param {boolean} useSystemTheme |
| 223 * @private | 223 * @private |
| 224 */ | 224 */ |
| 225 themeChanged_: function(themeId, useSystemTheme) { | 225 themeChanged_: function(themeId, useSystemTheme) { |
| 226 if (themeId) { | 226 if (themeId) { |
| 227 assert(!useSystemTheme); | 227 assert(!useSystemTheme); |
| 228 | 228 |
| 229 this.browserProxy_.getThemeInfo(themeId).then(function(info) { | 229 this.browserProxy_.getThemeInfo(themeId).then(function(info) { |
| 230 this.themeSublabel_ = info.name; | 230 this.themeSublabel_ = info.name; |
| 231 }.bind(this)); | 231 }.bind(this)); |
| 232 | 232 |
| 233 this.themeUrl_ = `https://chrome.google.com/webstore/detail/${themeId}`; | 233 this.themeUrl_ = `https://chrome.google.com/webstore/detail/${themeId}`; |
| 234 return; | 234 return; |
| 235 } | 235 } |
| 236 | 236 |
| 237 var i18nId; | 237 var i18nId; |
| 238 <if expr="is_linux and not chromeos"> | 238 /* <if expr="is_linux and not chromeos"> */ |
| 239 i18nId = useSystemTheme ? 'systemTheme' : 'classicTheme'; | 239 i18nId = useSystemTheme ? 'systemTheme' : 'classicTheme'; |
| 240 </if> | 240 /* </if> */ |
| 241 <if expr="not is_linux or chromeos"> | 241 /* <if expr="not is_linux or chromeos"> */ |
| 242 i18nId = 'chooseFromWebStore'; | 242 i18nId = 'chooseFromWebStore'; |
| 243 </if> | 243 /* </if> */ |
| 244 this.themeSublabel_ = this.i18n(i18nId); | 244 this.themeSublabel_ = this.i18n(i18nId); |
| 245 this.themeUrl_ = ''; | 245 this.themeUrl_ = ''; |
| 246 }, | 246 }, |
| 247 | 247 |
| 248 /** @private */ | 248 /** @private */ |
| 249 onZoomLevelChange_: function() { | 249 onZoomLevelChange_: function() { |
| 250 chrome.settingsPrivate.setDefaultZoom(parseFloat(this.$.zoomLevel.value)); | 250 chrome.settingsPrivate.setDefaultZoom(parseFloat(this.$.zoomLevel.value)); |
| 251 }, | 251 }, |
| 252 | 252 |
| 253 /** | 253 /** |
| 254 * @param {boolean} bookmarksBarVisible if bookmarks bar option is visible. | 254 * @param {boolean} bookmarksBarVisible if bookmarks bar option is visible. |
| 255 * @return {string} 'first' if the argument is false or empty otherwise. | 255 * @return {string} 'first' if the argument is false or empty otherwise. |
| 256 * @private | 256 * @private |
| 257 */ | 257 */ |
| 258 getFirst_: function(bookmarksBarVisible) { | 258 getFirst_: function(bookmarksBarVisible) { |
| 259 return !bookmarksBarVisible ? 'first' : ''; | 259 return !bookmarksBarVisible ? 'first' : ''; |
| 260 }, | 260 }, |
| 261 | 261 |
| 262 /** | 262 /** |
| 263 * @see content::ZoomValuesEqual(). | 263 * @see content::ZoomValuesEqual(). |
| 264 * @param {number} zoom1 | 264 * @param {number} zoom1 |
| 265 * @param {number} zoom2 | 265 * @param {number} zoom2 |
| 266 * @return {boolean} | 266 * @return {boolean} |
| 267 * @private | 267 * @private |
| 268 */ | 268 */ |
| 269 zoomValuesEqual_: function(zoom1, zoom2) { | 269 zoomValuesEqual_: function(zoom1, zoom2) { |
| 270 return Math.abs(zoom1 - zoom2) <= 0.001; | 270 return Math.abs(zoom1 - zoom2) <= 0.001; |
| 271 }, | 271 }, |
| 272 }); | 272 }); |
| OLD | NEW |