| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 }, | 50 }, |
| 51 | 51 |
| 52 /** @override */ | 52 /** @override */ |
| 53 ready: function() { | 53 ready: function() { |
| 54 if (this.model) { | 54 if (this.model) { |
| 55 this.dialogTitle_ = | 55 this.dialogTitle_ = |
| 56 loadTimeData.getString('searchEnginesEditSearchEngine'); | 56 loadTimeData.getString('searchEnginesEditSearchEngine'); |
| 57 this.actionButtonText_ = loadTimeData.getString('save'); | 57 this.actionButtonText_ = loadTimeData.getString('save'); |
| 58 | 58 |
| 59 // If editing an existing search engine, pre-populate the input fields. | 59 // If editing an existing search engine, pre-populate the input fields. |
| 60 this.searchEngine_ = this.model.displayName; | 60 this.searchEngine_ = this.model.name; |
| 61 this.keyword_ = this.model.keyword; | 61 this.keyword_ = this.model.keyword; |
| 62 this.queryUrl_ = this.model.url; | 62 this.queryUrl_ = this.model.url; |
| 63 } else { | 63 } else { |
| 64 this.dialogTitle_ = | 64 this.dialogTitle_ = |
| 65 loadTimeData.getString('searchEnginesAddSearchEngine'); | 65 loadTimeData.getString('searchEnginesAddSearchEngine'); |
| 66 this.actionButtonText_ = loadTimeData.getString('add'); | 66 this.actionButtonText_ = loadTimeData.getString('add'); |
| 67 } | 67 } |
| 68 | 68 |
| 69 this.addEventListener('iron-overlay-canceled', function() { | 69 this.addEventListener('iron-overlay-canceled', function() { |
| 70 this.browserProxy_.searchEngineEditCancelled(); | 70 this.browserProxy_.searchEngineEditCancelled(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 /** @private */ | 108 /** @private */ |
| 109 updateActionButtonState_: function() { | 109 updateActionButtonState_: function() { |
| 110 var allValid = [ | 110 var allValid = [ |
| 111 this.$.searchEngine, this.$.keyword, this.$.queryUrl | 111 this.$.searchEngine, this.$.keyword, this.$.queryUrl |
| 112 ].every(function(inputElement) { | 112 ].every(function(inputElement) { |
| 113 return !inputElement.invalid && inputElement.value.length != 0; | 113 return !inputElement.invalid && inputElement.value.length != 0; |
| 114 }); | 114 }); |
| 115 this.$.actionButton.disabled = !allValid; | 115 this.$.actionButton.disabled = !allValid; |
| 116 }, | 116 }, |
| 117 }); | 117 }); |
| OLD | NEW |