| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 cr.define('options.search_engines', function() { | 5 cr.define('options.search_engines', function() { |
| 6 const InlineEditableItemList = options.InlineEditableItemList; | 6 const InlineEditableItemList = options.InlineEditableItemList; |
| 7 const InlineEditableItem = options.InlineEditableItem; | 7 const InlineEditableItem = options.InlineEditableItem; |
| 8 const ListSelectionController = cr.ui.ListSelectionController; | 8 const ListSelectionController = cr.ui.ListSelectionController; |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 this.urlField_.placeholder = | 153 this.urlField_.placeholder = |
| 154 localStrings.getString('searchEngineTableURLPlaceholder'); | 154 localStrings.getString('searchEngineTableURLPlaceholder'); |
| 155 } | 155 } |
| 156 | 156 |
| 157 var fields = [ this.nameField_, this.keywordField_, this.urlField_ ]; | 157 var fields = [ this.nameField_, this.keywordField_, this.urlField_ ]; |
| 158 for (var i = 0; i < fields.length; i++) { | 158 for (var i = 0; i < fields.length; i++) { |
| 159 fields[i].oninput = this.startFieldValidation_.bind(this); | 159 fields[i].oninput = this.startFieldValidation_.bind(this); |
| 160 } | 160 } |
| 161 | 161 |
| 162 // Listen for edit events. | 162 // Listen for edit events. |
| 163 this.addEventListener('edit', this.onEditStarted_.bind(this)); | 163 if (engine['canBeEdited']) { |
| 164 this.addEventListener('canceledit', this.onEditCancelled_.bind(this)); | 164 this.addEventListener('edit', this.onEditStarted_.bind(this)); |
| 165 this.addEventListener('commitedit', this.onEditCommitted_.bind(this)); | 165 this.addEventListener('canceledit', this.onEditCancelled_.bind(this)); |
| 166 this.addEventListener('commitedit', this.onEditCommitted_.bind(this)); |
| 167 } else { |
| 168 this.editable = false; |
| 169 } |
| 166 }, | 170 }, |
| 167 | 171 |
| 168 /** @inheritDoc */ | 172 /** @inheritDoc */ |
| 169 get currentInputIsValid() { | 173 get currentInputIsValid() { |
| 170 return !this.waitingForValidation_ && this.currentlyValid_; | 174 return !this.waitingForValidation_ && this.currentlyValid_; |
| 171 }, | 175 }, |
| 172 | 176 |
| 173 /** @inheritDoc */ | 177 /** @inheritDoc */ |
| 174 get hasBeenEdited() { | 178 get hasBeenEdited() { |
| 175 var engine = this.searchEngine_; | 179 var engine = this.searchEngine_; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 }, | 307 }, |
| 304 }; | 308 }; |
| 305 | 309 |
| 306 // Export | 310 // Export |
| 307 return { | 311 return { |
| 308 SearchEngineList: SearchEngineList | 312 SearchEngineList: SearchEngineList |
| 309 }; | 313 }; |
| 310 | 314 |
| 311 }); | 315 }); |
| 312 | 316 |
| OLD | NEW |