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

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 3 more similar ones Created 3 years, 11 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 this.$.dialog.showModal(); 48 this.$.dialog.showModal();
49 }, 49 },
50 50
51 /** @private */ 51 /** @private */
52 onCancelTap_: function() { 52 onCancelTap_: function() {
53 this.$.dialog.close(); 53 this.$.dialog.close();
54 }, 54 },
55 55
56 /** @private */ 56 /** @private */
57 onActionButtonTap_: function() { 57 onActionButtonTap_: function() {
58 // This method may be called via keybinding, so we ignore invalid input.
59 if (this.$.actionButton.disabled)
60 return;
61
58 var whenDone = this.model ? 62 var whenDone = this.model ?
59 this.browserProxy_.editStartupPage(this.model.modelIndex, this.url_) : 63 this.browserProxy_.editStartupPage(this.model.modelIndex, this.url_) :
60 this.browserProxy_.addStartupPage(this.url_); 64 this.browserProxy_.addStartupPage(this.url_);
61 65
62 whenDone.then(function(success) { 66 whenDone.then(function(success) {
63 if (success) 67 if (success)
64 this.$.dialog.close(); 68 this.$.dialog.close();
65 // If the URL was invalid, there is nothing to do, just leave the dialog 69 // 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. 70 // open and let the user fix the URL or cancel.
67 }.bind(this)); 71 }.bind(this));
68 }, 72 },
69 73
70 /** @private */ 74 /** @private */
71 validate_: function() { 75 validate_: function() {
72 this.browserProxy_.validateStartupPage(this.url_).then(function(isValid) { 76 this.browserProxy_.validateStartupPage(this.url_).then(function(isValid) {
73 this.$.actionButton.disabled = !isValid; 77 this.$.actionButton.disabled = !isValid;
74 }.bind(this)); 78 }.bind(this));
75 }, 79 },
76 }); 80 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698