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

Side by Side Diff: chrome/browser/resources/settings/on_startup_page/startup_url_dialog.js

Issue 2653023003: MD Settings: Update some dialogs to accept Enter key. (Closed)
Patch Set: add a test for one of them Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 * @fileoverview 'settings-startup-url-dialog' is a component for adding 6 * @fileoverview 'settings-startup-url-dialog' is a component for adding
7 * or editing a startup URL entry. 7 * or editing a startup URL entry.
8 */ 8 */
9 Polymer({ 9 Polymer({
10 is: 'settings-startup-url-dialog', 10 is: 'settings-startup-url-dialog',
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 this.browserProxy_.addStartupPage(this.url_); 60 this.browserProxy_.addStartupPage(this.url_);
61 61
62 whenDone.then(function(success) { 62 whenDone.then(function(success) {
63 if (success) 63 if (success)
64 this.$.dialog.close(); 64 this.$.dialog.close();
65 // If the URL was invalid, there is nothing to do, just leave the dialog 65 // If the URL was invalid, there is nothing to do, just leave the dialog
66 // open and let the user fix the URL or cancel. 66 // open and let the user fix the URL or cancel.
67 }.bind(this)); 67 }.bind(this));
68 }, 68 },
69 69
70 /**
71 * @param {!KeyboardEvent} e
72 * @private
73 */
74 onKeypress_: function(e) {
75 if (e.key == 'Enter' && !this.$.actionButton.disabled)
76 this.onActionButtonTap_();
77 },
78
70 /** @private */ 79 /** @private */
71 validate_: function() { 80 validate_: function() {
72 this.browserProxy_.validateStartupPage(this.url_).then(function(isValid) { 81 this.browserProxy_.validateStartupPage(this.url_).then(function(isValid) {
73 this.$.actionButton.disabled = !isValid; 82 this.$.actionButton.disabled = !isValid;
74 }.bind(this)); 83 }.bind(this));
75 }, 84 },
76 }); 85 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698