OLD | NEW |
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 Loading... |
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 | |
79 /** @private */ | 70 /** @private */ |
80 validate_: function() { | 71 validate_: function() { |
81 this.browserProxy_.validateStartupPage(this.url_).then(function(isValid) { | 72 this.browserProxy_.validateStartupPage(this.url_).then(function(isValid) { |
82 this.$.actionButton.disabled = !isValid; | 73 this.$.actionButton.disabled = !isValid; |
83 }.bind(this)); | 74 }.bind(this)); |
84 }, | 75 }, |
85 }); | 76 }); |
OLD | NEW |