Index: chrome/browser/resources/settings/on_startup_page/startup_urls_page.js |
diff --git a/chrome/browser/resources/settings/on_startup_page/startup_urls_page.js b/chrome/browser/resources/settings/on_startup_page/startup_urls_page.js |
index c8ba1c61264f02f3122c94ac2c8d9cff95daed12..a4543a6e27dcf58ca4ed969d1bef78302415fb16 100644 |
--- a/chrome/browser/resources/settings/on_startup_page/startup_urls_page.js |
+++ b/chrome/browser/resources/settings/on_startup_page/startup_urls_page.js |
@@ -42,10 +42,16 @@ Polymer({ |
/** @private {string} */ |
newUrl_: { |
+ observer: 'newUrlChanged_', |
type: String, |
value: '', |
}, |
+ isNewUrlValid_: { |
dpapad
2016/03/31 18:39:56
Nit(optional): When the default value is false you
Dan Beam
2016/03/31 22:06:54
i wouldn't encourage this, as one might assume the
|
+ type: Boolean, |
+ value: false, |
+ }, |
+ |
/** |
* Pages to load upon browser startup. |
* @private {!Array<!StartupPageInfo>} |
@@ -93,17 +99,16 @@ Polymer({ |
this.$.addUrlDialog.close(); |
}, |
- /** |
- * @return {boolean} Whether tapping the Add button should be allowed. |
- * @private |
- */ |
- isAddEnabled_: function() { |
- return this.browserProxy_.canAddPage(this.newUrl_); |
+ /** @private */ |
+ newUrlChanged_: function() { |
+ this.browserProxy_.validateStartupPage(this.newUrl_).then(function(valid) { |
+ this.isNewUrlValid_ = valid; |
dpapad
2016/03/31 18:39:56
Nit (optional): s/valid/isValid
Dan Beam
2016/03/31 22:06:54
Done.
|
+ }.bind(this)); |
}, |
/** @private */ |
onAddTap_: function() { |
- assert(this.isAddEnabled_()); |
+ assert(this.isNewUrlValid_); |
this.browserProxy_.addStartupPage(this.newUrl_); |
this.$.addUrlDialog.close(); |
}, |