| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 */ var ControlledSettingIndicator = | 6 /** @const */ var ControlledSettingIndicator = |
| 7 options.ControlledSettingIndicator; | 7 options.ControlledSettingIndicator; |
| 8 /** @const */ var InlineEditableItemList = options.InlineEditableItemList; | 8 /** @const */ var InlineEditableItemList = options.InlineEditableItemList; |
| 9 /** @const */ var InlineEditableItem = options.InlineEditableItem; | 9 /** @const */ var InlineEditableItem = options.InlineEditableItem; |
| 10 /** @const */ var ListSelectionController = cr.ui.ListSelectionController; | 10 /** @const */ var ListSelectionController = cr.ui.ListSelectionController; |
| 11 | 11 |
| 12 /** | 12 /** |
| 13 * Creates a new search engine list item. | 13 * Creates a new search engine list item. |
| 14 * @param {Object} searchEnigne The search engine this represents. | 14 * @param {Object} searchEngine The search engine this represents. |
| 15 * @constructor | 15 * @constructor |
| 16 * @extends {cr.ui.ListItem} | 16 * @extends {cr.ui.ListItem} |
| 17 */ | 17 */ |
| 18 function SearchEngineListItem(searchEngine) { | 18 function SearchEngineListItem(searchEngine) { |
| 19 var el = cr.doc.createElement('div'); | 19 var el = cr.doc.createElement('div'); |
| 20 el.searchEngine_ = searchEngine; | 20 el.searchEngine_ = searchEngine; |
| 21 SearchEngineListItem.decorate(el); | 21 SearchEngineListItem.decorate(el); |
| 22 return el; | 22 return el; |
| 23 } | 23 } |
| 24 | 24 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 onEditCommitted_: function(e) { | 228 onEditCommitted_: function(e) { |
| 229 chrome.send('searchEngineEditCompleted', this.getInputFieldValues_()); | 229 chrome.send('searchEngineEditCompleted', this.getInputFieldValues_()); |
| 230 }, | 230 }, |
| 231 | 231 |
| 232 /** | 232 /** |
| 233 * Called when cancelling an edit; informs the model and resets the control | 233 * Called when cancelling an edit; informs the model and resets the control |
| 234 * states. | 234 * states. |
| 235 * @param {Event} e The cancel event. | 235 * @param {Event} e The cancel event. |
| 236 * @private | 236 * @private |
| 237 */ | 237 */ |
| 238 onEditCancelled_: function() { | 238 onEditCancelled_: function(e) { |
| 239 chrome.send('searchEngineEditCancelled'); | 239 chrome.send('searchEngineEditCancelled'); |
| 240 | 240 |
| 241 // The name field has been automatically set to match the display name, | 241 // The name field has been automatically set to match the display name, |
| 242 // but it should use the raw name instead. | 242 // but it should use the raw name instead. |
| 243 this.nameField_.value = this.searchEngine_.name; | 243 this.nameField_.value = this.searchEngine_.name; |
| 244 this.currentlyValid_ = !this.isPlaceholder; | 244 this.currentlyValid_ = !this.isPlaceholder; |
| 245 }, | 245 }, |
| 246 | 246 |
| 247 /** | 247 /** |
| 248 * Returns the input field values as an array suitable for passing to | 248 * Returns the input field values as an array suitable for passing to |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 }, | 333 }, |
| 334 }; | 334 }; |
| 335 | 335 |
| 336 // Export | 336 // Export |
| 337 return { | 337 return { |
| 338 SearchEngineList: SearchEngineList | 338 SearchEngineList: SearchEngineList |
| 339 }; | 339 }; |
| 340 | 340 |
| 341 }); | 341 }); |
| 342 | 342 |
| OLD | NEW |