Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: chrome/browser/resources/settings/appearance_page/appearance_page.js

Issue 2766093002: MD Settings: validate home button url input (Closed)
Patch Set: fix formatting Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 return [ 45 return [
46 {value: 9, name: loadTimeData.getString('verySmall')}, 46 {value: 9, name: loadTimeData.getString('verySmall')},
47 {value: 12, name: loadTimeData.getString('small')}, 47 {value: 12, name: loadTimeData.getString('small')},
48 {value: 16, name: loadTimeData.getString('medium')}, 48 {value: 16, name: loadTimeData.getString('medium')},
49 {value: 20, name: loadTimeData.getString('large')}, 49 {value: 20, name: loadTimeData.getString('large')},
50 {value: 24, name: loadTimeData.getString('veryLarge')}, 50 {value: 24, name: loadTimeData.getString('veryLarge')},
51 ]; 51 ];
52 }, 52 },
53 }, 53 },
54 54
55 /** @private */
56 isHomeUrlInvalid_: Boolean,
57
55 /** 58 /**
56 * List of options for the page zoom drop-down menu. 59 * List of options for the page zoom drop-down menu.
57 * @type {!Array<number>} 60 * @type {!Array<number>}
58 */ 61 */
59 pageZoomLevels_: { 62 pageZoomLevels_: {
60 readOnly: true, 63 readOnly: true,
61 type: Array, 64 type: Array,
62 value: [ 65 value: [
63 // TODO(dbeam): get these dynamically from C++ instead. 66 // TODO(dbeam): get these dynamically from C++ instead.
64 1 / 4, 67 1 / 4,
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 /** @private */ 154 /** @private */
152 onDisableExtension_: function() { 155 onDisableExtension_: function() {
153 this.fire('refresh-pref', 'homepage'); 156 this.fire('refresh-pref', 'homepage');
154 }, 157 },
155 158
156 /** @private */ 159 /** @private */
157 onThemesTap_: function() { 160 onThemesTap_: function() {
158 window.open(this.themeUrl_ || loadTimeData.getString('themesGalleryUrl')); 161 window.open(this.themeUrl_ || loadTimeData.getString('themesGalleryUrl'));
159 }, 162 },
160 163
161 // <if expr="chromeos"> 164 // <if expr="chromeos">
162 /** 165 /**
163 * ChromeOS only. 166 * ChromeOS only.
164 * @private 167 * @private
165 */ 168 */
166 openWallpaperManager_: function() { 169 openWallpaperManager_: function() {
167 this.browserProxy_.openWallpaperManager(); 170 this.browserProxy_.openWallpaperManager();
168 }, 171 },
169 // </if> 172 // </if>
170 173
171 /** @private */ 174 /** @private */
172 onUseDefaultTap_: function() { 175 onUseDefaultTap_: function() {
173 this.browserProxy_.useDefaultTheme(); 176 this.browserProxy_.useDefaultTheme();
174 }, 177 },
175 178
176 // <if expr="is_linux and not chromeos"> 179 // <if expr="is_linux and not chromeos">
177 /** 180 /**
178 * @param {boolean} useSystemTheme 181 * @param {boolean} useSystemTheme
179 * @private 182 * @private
180 */ 183 */
181 useSystemThemePrefChanged_: function(useSystemTheme) { 184 useSystemThemePrefChanged_: function(useSystemTheme) {
182 this.useSystemTheme_ = useSystemTheme; 185 this.useSystemTheme_ = useSystemTheme;
183 }, 186 },
184 187
185 /** 188 /**
186 * @param {string} themeId 189 * @param {string} themeId
(...skipping 24 matching lines...) Expand all
211 */ 214 */
212 showThemesSecondary_: function(themeId, useSystemTheme) { 215 showThemesSecondary_: function(themeId, useSystemTheme) {
213 return this.showUseClassic_(themeId, useSystemTheme) || 216 return this.showUseClassic_(themeId, useSystemTheme) ||
214 this.showUseSystem_(themeId, useSystemTheme); 217 this.showUseSystem_(themeId, useSystemTheme);
215 }, 218 },
216 219
217 /** @private */ 220 /** @private */
218 onUseSystemTap_: function() { 221 onUseSystemTap_: function() {
219 this.browserProxy_.useSystemTheme(); 222 this.browserProxy_.useSystemTheme();
220 }, 223 },
221 // </if> 224 // </if>
222 225
223 /** 226 /**
224 * @param {string} themeId 227 * @param {string} themeId
225 * @param {boolean} useSystemTheme 228 * @param {boolean} useSystemTheme
226 * @private 229 * @private
227 */ 230 */
228 themeChanged_: function(themeId, useSystemTheme) { 231 themeChanged_: function(themeId, useSystemTheme) {
229 if (themeId) { 232 if (themeId) {
230 assert(!useSystemTheme); 233 assert(!useSystemTheme);
231 234
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 /** 268 /**
266 * @see content::ZoomValuesEqual(). 269 * @see content::ZoomValuesEqual().
267 * @param {number} zoom1 270 * @param {number} zoom1
268 * @param {number} zoom2 271 * @param {number} zoom2
269 * @return {boolean} 272 * @return {boolean}
270 * @private 273 * @private
271 */ 274 */
272 zoomValuesEqual_: function(zoom1, zoom2) { 275 zoomValuesEqual_: function(zoom1, zoom2) {
273 return Math.abs(zoom1 - zoom2) <= 0.001; 276 return Math.abs(zoom1 - zoom2) <= 0.001;
274 }, 277 },
278
279 /**
280 * @param {!Event} event
281 * @private
282 */
283 validate_: function(event) {
284 var inputElement = Polymer.dom(event).localTarget;
285
286 if (inputElement.value == '') {
Dan Beam 2017/03/27 11:43:07 why handle this special case differently?
scottchen 2017/03/28 21:02:20 Same behavior as on-startup page setup currently -
287 this.isHomeUrlInvalid_ = false;
288 return;
289 }
290
291 this.browserProxy_.validateStartupPage(inputElement.value)
292 .then(function(isValid) {
293 this.isHomeUrlInvalid_ = !isValid;
294 }.bind(this));
295 },
275 }); 296 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698