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 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 151 /** @private */ | 151 /** @private */ |
| 152 onDisableExtension_: function() { | 152 onDisableExtension_: function() { |
| 153 this.fire('refresh-pref', 'homepage'); | 153 this.fire('refresh-pref', 'homepage'); |
| 154 }, | 154 }, |
| 155 | 155 |
| 156 /** @private */ | 156 /** @private */ |
| 157 onThemesTap_: function() { | 157 onThemesTap_: function() { |
| 158 window.open(this.themeUrl_ || loadTimeData.getString('themesGalleryUrl')); | 158 window.open(this.themeUrl_ || loadTimeData.getString('themesGalleryUrl')); |
| 159 }, | 159 }, |
| 160 | 160 |
| 161 // <if expr="chromeos"> | 161 // <if expr="chromeos"> |
| 162 /** | 162 /** |
| 163 * ChromeOS only. | 163 * ChromeOS only. |
| 164 * @private | 164 * @private |
| 165 */ | 165 */ |
| 166 openWallpaperManager_: function() { | 166 openWallpaperManager_: function() { |
| 167 this.browserProxy_.openWallpaperManager(); | 167 this.browserProxy_.openWallpaperManager(); |
| 168 }, | 168 }, |
| 169 // </if> | 169 // </if> |
| 170 | 170 |
| 171 /** @private */ | 171 /** @private */ |
| 172 onUseDefaultTap_: function() { | 172 onUseDefaultTap_: function() { |
| 173 this.browserProxy_.useDefaultTheme(); | 173 this.browserProxy_.useDefaultTheme(); |
| 174 }, | 174 }, |
| 175 | 175 |
| 176 // <if expr="is_linux and not chromeos"> | 176 // <if expr="is_linux and not chromeos"> |
| 177 /** | 177 /** |
| 178 * @param {boolean} useSystemTheme | 178 * @param {boolean} useSystemTheme |
| 179 * @private | 179 * @private |
| 180 */ | 180 */ |
| 181 useSystemThemePrefChanged_: function(useSystemTheme) { | 181 useSystemThemePrefChanged_: function(useSystemTheme) { |
| 182 this.useSystemTheme_ = useSystemTheme; | 182 this.useSystemTheme_ = useSystemTheme; |
| 183 }, | 183 }, |
| 184 | 184 |
| 185 /** | 185 /** |
| 186 * @param {string} themeId | 186 * @param {string} themeId |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 211 */ | 211 */ |
| 212 showThemesSecondary_: function(themeId, useSystemTheme) { | 212 showThemesSecondary_: function(themeId, useSystemTheme) { |
| 213 return this.showUseClassic_(themeId, useSystemTheme) || | 213 return this.showUseClassic_(themeId, useSystemTheme) || |
| 214 this.showUseSystem_(themeId, useSystemTheme); | 214 this.showUseSystem_(themeId, useSystemTheme); |
| 215 }, | 215 }, |
| 216 | 216 |
| 217 /** @private */ | 217 /** @private */ |
| 218 onUseSystemTap_: function() { | 218 onUseSystemTap_: function() { |
| 219 this.browserProxy_.useSystemTheme(); | 219 this.browserProxy_.useSystemTheme(); |
| 220 }, | 220 }, |
| 221 // </if> | 221 // </if> |
| 222 | 222 |
| 223 /** | 223 /** |
| 224 * @param {string} themeId | 224 * @param {string} themeId |
| 225 * @param {boolean} useSystemTheme | 225 * @param {boolean} useSystemTheme |
| 226 * @private | 226 * @private |
| 227 */ | 227 */ |
| 228 themeChanged_: function(themeId, useSystemTheme) { | 228 themeChanged_: function(themeId, useSystemTheme) { |
| 229 if (themeId) { | 229 if (themeId) { |
| 230 assert(!useSystemTheme); | 230 assert(!useSystemTheme); |
| 231 | 231 |
| 232 this.browserProxy_.getThemeInfo(themeId).then(function(info) { | 232 this.browserProxy_.getThemeInfo(themeId).then(function(info) { |
| 233 this.themeSublabel_ = info.name; | 233 this.themeSublabel_ = info.name; |
| 234 }.bind(this)); | 234 }.bind(this)); |
| 235 | 235 |
| 236 this.themeUrl_ = 'https://chrome.google.com/webstore/detail/' + themeId; | 236 this.themeUrl_ = 'https://chrome.google.com/webstore/detail/' + themeId; |
| 237 return; | 237 return; |
| 238 } | 238 } |
| 239 | 239 |
| 240 var i18nId; | 240 var i18nId; |
| 241 // <if expr="is_linux and not chromeos"> | 241 // <if expr="is_linux and not chromeos"> |
| 242 i18nId = useSystemTheme ? 'systemTheme' : 'classicTheme'; | 242 i18nId = useSystemTheme ? 'systemTheme' : 'classicTheme'; |
| 243 // </if> | 243 // </if> |
| 244 // <if expr="not is_linux or chromeos"> | 244 // <if expr="not is_linux or chromeos"> |
| 245 i18nId = 'chooseFromWebStore'; | 245 i18nId = 'chooseFromWebStore'; |
| 246 // </if> | 246 // </if> |
| 247 this.themeSublabel_ = this.i18n(i18nId); | 247 this.themeSublabel_ = this.i18n(i18nId); |
| 248 this.themeUrl_ = ''; | 248 this.themeUrl_ = ''; |
| 249 }, | 249 }, |
| 250 | 250 |
| 251 /** @private */ | 251 /** @private */ |
| 252 onZoomLevelChange_: function() { | 252 onZoomLevelChange_: function() { |
| 253 chrome.settingsPrivate.setDefaultZoom(parseFloat(this.$.zoomLevel.value)); | 253 chrome.settingsPrivate.setDefaultZoom(parseFloat(this.$.zoomLevel.value)); |
| 254 }, | 254 }, |
| 255 | 255 |
| 256 /** | 256 /** |
| 257 * @param {boolean} bookmarksBarVisible if bookmarks bar option is visible. | 257 * @param {boolean} bookmarksBarVisible if bookmarks bar option is visible. |
| 258 * @return {string} 'first' if the argument is false or empty otherwise. | 258 * @return {string} 'first' if the argument is false or empty otherwise. |
| 259 * @private | 259 * @private |
| 260 */ | 260 */ |
| 261 getFirst_: function(bookmarksBarVisible) { | 261 getFirst_: function(bookmarksBarVisible) { |
| 262 return !bookmarksBarVisible ? 'first' : ''; | 262 return !bookmarksBarVisible ? 'first' : ''; |
| 263 }, | 263 }, |
| 264 | 264 |
| 265 /** | 265 /** |
| 266 * @see content::ZoomValuesEqual(). | 266 * @see content::ZoomValuesEqual(). |
| 267 * @param {number} zoom1 | 267 * @param {number} zoom1 |
| 268 * @param {number} zoom2 | 268 * @param {number} zoom2 |
| 269 * @return {boolean} | 269 * @return {boolean} |
| 270 * @private | 270 * @private |
| 271 */ | 271 */ |
| 272 zoomValuesEqual_: function(zoom1, zoom2) { | 272 zoomValuesEqual_: function(zoom1, zoom2) { |
| 273 return Math.abs(zoom1 - zoom2) <= 0.001; | 273 return Math.abs(zoom1 - zoom2) <= 0.001; |
| 274 }, | 274 }, |
| 275 | |
| 276 validate_: function(event) { | |
|
dpapad
2017/03/24 01:39:31
@param, @private missing.
scottchen
2017/03/24 20:48:54
Done.
| |
| 277 var inputElement = Polymer.dom(event).localTarget; | |
| 278 | |
| 279 if (inputElement.value == '') { | |
| 280 inputElement.invalid = false; | |
|
dpapad
2017/03/24 01:39:31
Can we use data binding instead?
// in appearanc
scottchen
2017/03/24 20:48:54
Done.
| |
| 281 return; | |
| 282 } | |
| 283 | |
| 284 this.browserProxy_.validateStartupPage(inputElement.value) | |
| 285 .then(function(isValid) { | |
| 286 inputElement.invalid = !isValid; | |
| 287 }.bind(this)); | |
| 288 }, | |
| 275 }); | 289 }); |
| OLD | NEW |