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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 // If element is empty, disable the action button, but don't show the red | 101 // If element is empty, disable the action button, but don't show the red |
102 // invalid message. | 102 // invalid message. |
103 if (inputElement.value == '') { | 103 if (inputElement.value == '') { |
104 inputElement.invalid = false; | 104 inputElement.invalid = false; |
105 this.updateActionButtonState_(); | 105 this.updateActionButtonState_(); |
106 return; | 106 return; |
107 } | 107 } |
108 | 108 |
109 this.browserProxy_.validateSearchEngineInput( | 109 this.browserProxy_.validateSearchEngineInput( |
110 inputElement.id, inputElement.value).then(function(isValid) { | 110 inputElement.id, inputElement.value).then(function(isValid) { |
111 inputElement.invalid = !isValid; | 111 inputElement.invalid = !isValid; |
112 this.updateActionButtonState_(); | 112 this.updateActionButtonState_(); |
113 }.bind(this)); | 113 }.bind(this)); |
114 }, | 114 }, |
115 | 115 |
116 /** @private */ | 116 /** @private */ |
117 updateActionButtonState_: function() { | 117 updateActionButtonState_: function() { |
118 var allValid = [ | 118 var allValid = [ |
119 this.$.searchEngine, this.$.keyword, this.$.queryUrl | 119 this.$.searchEngine, this.$.keyword, this.$.queryUrl |
120 ].every(function(inputElement) { | 120 ].every(function(inputElement) { |
121 return !inputElement.invalid && inputElement.value.length > 0; | 121 return !inputElement.invalid && inputElement.value.length > 0; |
122 }); | 122 }); |
123 this.$.actionButton.disabled = !allValid; | 123 this.$.actionButton.disabled = !allValid; |
124 }, | 124 }, |
125 }); | 125 }); |
OLD | NEW |