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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/settings/appearance_page/appearance_page.js
diff --git a/chrome/browser/resources/settings/appearance_page/appearance_page.js b/chrome/browser/resources/settings/appearance_page/appearance_page.js
index cec64245e5f3368fe3dea9cac644bb4a5402b29d..4eece5c2a56988004bb6d270bdd2069892982dbd 100644
--- a/chrome/browser/resources/settings/appearance_page/appearance_page.js
+++ b/chrome/browser/resources/settings/appearance_page/appearance_page.js
@@ -52,6 +52,9 @@ Polymer({
},
},
+ /** @private */
+ isHomeUrlInvalid_: Boolean,
+
/**
* List of options for the page zoom drop-down menu.
* @type {!Array<number>}
@@ -158,7 +161,7 @@ Polymer({
window.open(this.themeUrl_ || loadTimeData.getString('themesGalleryUrl'));
},
-// <if expr="chromeos">
+ // <if expr="chromeos">
/**
* ChromeOS only.
* @private
@@ -166,14 +169,14 @@ Polymer({
openWallpaperManager_: function() {
this.browserProxy_.openWallpaperManager();
},
-// </if>
+ // </if>
/** @private */
onUseDefaultTap_: function() {
this.browserProxy_.useDefaultTheme();
},
-// <if expr="is_linux and not chromeos">
+ // <if expr="is_linux and not chromeos">
/**
* @param {boolean} useSystemTheme
* @private
@@ -218,7 +221,7 @@ Polymer({
onUseSystemTap_: function() {
this.browserProxy_.useSystemTheme();
},
-// </if>
+ // </if>
/**
* @param {string} themeId
@@ -272,4 +275,22 @@ Polymer({
zoomValuesEqual_: function(zoom1, zoom2) {
return Math.abs(zoom1 - zoom2) <= 0.001;
},
+
+ /**
+ * @param {!Event} event
+ * @private
+ */
+ validate_: function(event) {
+ var inputElement = Polymer.dom(event).localTarget;
+
+ 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 -
+ this.isHomeUrlInvalid_ = false;
+ return;
+ }
+
+ this.browserProxy_.validateStartupPage(inputElement.value)
+ .then(function(isValid) {
+ this.isHomeUrlInvalid_ = !isValid;
+ }.bind(this));
+ },
});

Powered by Google App Engine
This is Rietveld 408576698