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

Unified Diff: chrome/browser/resources/settings/on_startup_page/startup_urls_page.js

Issue 1752633002: MD Settings: disable the On Startup "OK" button with no site content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: trim() Created 4 years, 10 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
« no previous file with comments | « chrome/browser/resources/settings/on_startup_page/startup_urls_page.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 524a21dd58c7d1ea2d668e667256f98b7c61d6e2..35378eadfaa13989a100cfd31c8da71539b3d115 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
@@ -38,8 +38,10 @@ Polymer({
notify: true,
},
- newUrl: {
+ /** @private {string} */
+ newUrl_: {
type: String,
+ value: '',
},
/**
@@ -68,6 +70,7 @@ Polymer({
/** @private */
onAddPageTap_: function() {
+ this.newUrl_ = '';
this.$.addUrlDialog.open();
},
@@ -81,13 +84,18 @@ Polymer({
this.$.addUrlDialog.close();
},
+ /**
+ * @return {boolean} Whether tapping the OK button should be allowed.
+ * @private
+ */
+ isOkAllowed_: function() {
+ return this.newUrl_.trim().length > 0;
+ },
+
/** @private */
onOkTap_: function() {
- var value = this.newUrl && this.newUrl.trim();
- if (!value)
- return;
- chrome.send('addStartupPage', [value]);
- this.newUrl = '';
+ assert(this.isOkAllowed_());
+ chrome.send('addStartupPage', [this.newUrl_.trim()]);
this.$.addUrlDialog.close();
},
« no previous file with comments | « chrome/browser/resources/settings/on_startup_page/startup_urls_page.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698