| 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-search-engine-dialog' is a component for adding | 6 * @fileoverview 'settings-search-engine-dialog' is a component for adding |
| 7 * or editing a search engine entry. | 7 * or editing a search engine entry. |
| 8 */ | 8 */ |
| 9 Polymer({ | 9 Polymer({ |
| 10 is: 'settings-search-engine-dialog', | 10 is: 'settings-search-engine-dialog', |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 this.$.dialog.showModal(); | 79 this.$.dialog.showModal(); |
| 80 }, | 80 }, |
| 81 | 81 |
| 82 /** @private */ | 82 /** @private */ |
| 83 cancel_: function() { | 83 cancel_: function() { |
| 84 this.$.dialog.cancel(); | 84 this.$.dialog.cancel(); |
| 85 }, | 85 }, |
| 86 | 86 |
| 87 /** @private */ | 87 /** @private */ |
| 88 onActionButtonTap_: function() { | 88 onActionButtonTap_: function() { |
| 89 // This method may be called via keybinding, so we ignore invalid input. |
| 90 if (this.$.actionButton.disabled) |
| 91 return; |
| 92 |
| 89 this.browserProxy_.searchEngineEditCompleted( | 93 this.browserProxy_.searchEngineEditCompleted( |
| 90 this.searchEngine_, this.keyword_, this.queryUrl_); | 94 this.searchEngine_, this.keyword_, this.queryUrl_); |
| 91 this.$.dialog.close(); | 95 this.$.dialog.close(); |
| 92 }, | 96 }, |
| 93 | 97 |
| 94 /** | 98 /** |
| 95 * @param {!Event} event | 99 * @param {!Event} event |
| 96 * @private | 100 * @private |
| 97 */ | 101 */ |
| 98 validate_: function(event) { | 102 validate_: function(event) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 116 /** @private */ | 120 /** @private */ |
| 117 updateActionButtonState_: function() { | 121 updateActionButtonState_: function() { |
| 118 var allValid = [ | 122 var allValid = [ |
| 119 this.$.searchEngine, this.$.keyword, this.$.queryUrl | 123 this.$.searchEngine, this.$.keyword, this.$.queryUrl |
| 120 ].every(function(inputElement) { | 124 ].every(function(inputElement) { |
| 121 return !inputElement.invalid && inputElement.value.length > 0; | 125 return !inputElement.invalid && inputElement.value.length > 0; |
| 122 }); | 126 }); |
| 123 this.$.actionButton.disabled = !allValid; | 127 this.$.actionButton.disabled = !allValid; |
| 124 }, | 128 }, |
| 125 }); | 129 }); |
| OLD | NEW |