| 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 /** | 6 /** |
| 7 * This is the absolute difference maintained between standard and | 7 * This is the absolute difference maintained between standard and |
| 8 * fixed-width font sizes. http://crbug.com/91922. | 8 * fixed-width font sizes. http://crbug.com/91922. |
| 9 * @const @private {number} | 9 * @const @private {number} |
| 10 */ | 10 */ |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 }, | 115 }, |
| 116 }, | 116 }, |
| 117 | 117 |
| 118 /** @private {?settings.AppearanceBrowserProxy} */ | 118 /** @private {?settings.AppearanceBrowserProxy} */ |
| 119 browserProxy_: null, | 119 browserProxy_: null, |
| 120 | 120 |
| 121 observers: [ | 121 observers: [ |
| 122 'defaultFontSizeChanged_(prefs.webkit.webprefs.default_font_size.value)', | 122 'defaultFontSizeChanged_(prefs.webkit.webprefs.default_font_size.value)', |
| 123 'themeChanged_(prefs.extensions.theme.id.value, useSystemTheme_)', | 123 'themeChanged_(prefs.extensions.theme.id.value, useSystemTheme_)', |
| 124 | 124 |
| 125 // <if expr="is_linux and not chromeos"> | 125 // <if expr="is_linux and not chromeos"> |
| 126 // NOTE: this pref only exists on Linux. | 126 // NOTE: this pref only exists on Linux. |
| 127 'useSystemThemePrefChanged_(prefs.extensions.theme.use_system.value)', | 127 'useSystemThemePrefChanged_(prefs.extensions.theme.use_system.value)', |
| 128 // </if> | 128 // </if> |
| 129 ], | 129 ], |
| 130 | 130 |
| 131 /** @override */ | 131 /** @override */ |
| 132 created: function() { | 132 created: function() { |
| 133 this.browserProxy_ = settings.AppearanceBrowserProxyImpl.getInstance(); | 133 this.browserProxy_ = settings.AppearanceBrowserProxyImpl.getInstance(); |
| 134 }, | 134 }, |
| 135 | 135 |
| 136 /** @override */ | 136 /** @override */ |
| 137 ready: function() { | 137 ready: function() { |
| 138 this.$.defaultFontSize.menuOptions = this.fontSizeOptions_; | 138 this.$.defaultFontSize.menuOptions = this.fontSizeOptions_; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 | 191 |
| 192 /** | 192 /** |
| 193 * URL for either current theme or the theme gallery. | 193 * URL for either current theme or the theme gallery. |
| 194 * @return {string} | 194 * @return {string} |
| 195 * @private | 195 * @private |
| 196 */ | 196 */ |
| 197 getThemeHref_: function() { | 197 getThemeHref_: function() { |
| 198 return this.themeUrl_ || loadTimeData.getString('themesGalleryUrl'); | 198 return this.themeUrl_ || loadTimeData.getString('themesGalleryUrl'); |
| 199 }, | 199 }, |
| 200 | 200 |
| 201 // <if expr="chromeos"> | 201 // <if expr="chromeos"> |
| 202 /** | 202 /** |
| 203 * ChromeOS only. | 203 * ChromeOS only. |
| 204 * @private | 204 * @private |
| 205 */ | 205 */ |
| 206 openWallpaperManager_: function() { | 206 openWallpaperManager_: function() { |
| 207 this.browserProxy_.openWallpaperManager(); | 207 this.browserProxy_.openWallpaperManager(); |
| 208 }, | 208 }, |
| 209 // </if> | 209 // </if> |
| 210 | 210 |
| 211 /** @private */ | 211 /** @private */ |
| 212 onUseDefaultTap_: function() { | 212 onUseDefaultTap_: function() { |
| 213 this.browserProxy_.useDefaultTheme(); | 213 this.browserProxy_.useDefaultTheme(); |
| 214 }, | 214 }, |
| 215 | 215 |
| 216 // <if expr="is_linux and not chromeos"> | 216 // <if expr="is_linux and not chromeos"> |
| 217 /** | 217 /** |
| 218 * @param {boolean} useSystemTheme | 218 * @param {boolean} useSystemTheme |
| 219 * @private | 219 * @private |
| 220 */ | 220 */ |
| 221 useSystemThemePrefChanged_: function(useSystemTheme) { | 221 useSystemThemePrefChanged_: function(useSystemTheme) { |
| 222 this.useSystemTheme_ = useSystemTheme; | 222 this.useSystemTheme_ = useSystemTheme; |
| 223 }, | 223 }, |
| 224 | 224 |
| 225 /** | 225 /** |
| 226 * @param {string} themeId | 226 * @param {string} themeId |
| (...skipping 17 matching lines...) Expand all Loading... |
| 244 | 244 |
| 245 /** | 245 /** |
| 246 * @param {string} themeId | 246 * @param {string} themeId |
| 247 * @param {boolean} useSystemTheme | 247 * @param {boolean} useSystemTheme |
| 248 * @return {boolean} Whether to show the secondary area where "USE CLASSIC" | 248 * @return {boolean} Whether to show the secondary area where "USE CLASSIC" |
| 249 * and "USE GTK+" buttons live. | 249 * and "USE GTK+" buttons live. |
| 250 * @private | 250 * @private |
| 251 */ | 251 */ |
| 252 showThemesSecondary_: function(themeId, useSystemTheme) { | 252 showThemesSecondary_: function(themeId, useSystemTheme) { |
| 253 return this.showUseClassic_(themeId, useSystemTheme) || | 253 return this.showUseClassic_(themeId, useSystemTheme) || |
| 254 this.showUseSystem_(themeId, useSystemTheme); | 254 this.showUseSystem_(themeId, useSystemTheme); |
| 255 }, | 255 }, |
| 256 | 256 |
| 257 /** @private */ | 257 /** @private */ |
| 258 onUseSystemTap_: function() { | 258 onUseSystemTap_: function() { |
| 259 this.browserProxy_.useSystemTheme(); | 259 this.browserProxy_.useSystemTheme(); |
| 260 }, | 260 }, |
| 261 // </if> | 261 // </if> |
| 262 | 262 |
| 263 /** | 263 /** |
| 264 * @param {string} themeId | 264 * @param {string} themeId |
| 265 * @param {boolean} useSystemTheme | 265 * @param {boolean} useSystemTheme |
| 266 * @private | 266 * @private |
| 267 */ | 267 */ |
| 268 themeChanged_: function(themeId, useSystemTheme) { | 268 themeChanged_: function(themeId, useSystemTheme) { |
| 269 if (themeId) { | 269 if (themeId) { |
| 270 assert(!useSystemTheme); | 270 assert(!useSystemTheme); |
| 271 | 271 |
| 272 this.browserProxy_.getThemeInfo(themeId).then(function(info) { | 272 this.browserProxy_.getThemeInfo(themeId).then(function(info) { |
| 273 this.themeSublabel_ = info.name; | 273 this.themeSublabel_ = info.name; |
| 274 }.bind(this)); | 274 }.bind(this)); |
| 275 | 275 |
| 276 this.themeUrl_ = 'https://chrome.google.com/webstore/detail/' + themeId; | 276 this.themeUrl_ = 'https://chrome.google.com/webstore/detail/' + themeId; |
| 277 return; | 277 return; |
| 278 } | 278 } |
| 279 | 279 |
| 280 var i18nId; | 280 var i18nId; |
| 281 // <if expr="is_linux and not chromeos"> | 281 // <if expr="is_linux and not chromeos"> |
| 282 i18nId = useSystemTheme ? 'systemTheme' : 'classicTheme'; | 282 i18nId = useSystemTheme ? 'systemTheme' : 'classicTheme'; |
| 283 // </if> | 283 // </if> |
| 284 // <if expr="not is_linux or chromeos"> | 284 // <if expr="not is_linux or chromeos"> |
| 285 i18nId = 'chooseFromWebStore'; | 285 i18nId = 'chooseFromWebStore'; |
| 286 // </if> | 286 // </if> |
| 287 this.themeSublabel_ = this.i18n(i18nId); | 287 this.themeSublabel_ = this.i18n(i18nId); |
| 288 this.themeUrl_ = ''; | 288 this.themeUrl_ = ''; |
| 289 }, | 289 }, |
| 290 | 290 |
| 291 /** @private */ | 291 /** @private */ |
| 292 onZoomLevelChange_: function() { | 292 onZoomLevelChange_: function() { |
| 293 chrome.settingsPrivate.setDefaultZoom(parseFloat(this.$.zoomLevel.value)); | 293 chrome.settingsPrivate.setDefaultZoom(parseFloat(this.$.zoomLevel.value)); |
| 294 }, | 294 }, |
| 295 | 295 |
| 296 /** | 296 /** |
| 297 * @param {boolean} bookmarksBarVisible if bookmarks bar option is visible. | 297 * @param {boolean} bookmarksBarVisible if bookmarks bar option is visible. |
| 298 * @return {string} 'first' if the argument is false or empty otherwise. | 298 * @return {string} 'first' if the argument is false or empty otherwise. |
| 299 * @private | 299 * @private |
| 300 */ | 300 */ |
| 301 getFirst_: function(bookmarksBarVisible) { | 301 getFirst_: function(bookmarksBarVisible) { |
| 302 return !bookmarksBarVisible ? 'first' : ''; | 302 return !bookmarksBarVisible ? 'first' : ''; |
| 303 }, | 303 }, |
| 304 | 304 |
| 305 /** | 305 /** |
| 306 * @see content::ZoomValuesEqual(). | 306 * @see content::ZoomValuesEqual(). |
| 307 * @param {number} zoom1 | 307 * @param {number} zoom1 |
| 308 * @param {number} zoom2 | 308 * @param {number} zoom2 |
| 309 * @return {boolean} | 309 * @return {boolean} |
| 310 * @private | 310 * @private |
| 311 */ | 311 */ |
| 312 zoomValuesEqual_: function(zoom1, zoom2) { | 312 zoomValuesEqual_: function(zoom1, zoom2) { |
| 313 return Math.abs(zoom1 - zoom2) <= 0.001; | 313 return Math.abs(zoom1 - zoom2) <= 0.001; |
| 314 }, | 314 }, |
| 315 }); | 315 }); |
| OLD | NEW |