| 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; |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } | 173 } |
| 174 | 174 |
| 175 // Listen for edit events. | 175 // Listen for edit events. |
| 176 if (engine.canBeEdited) { | 176 if (engine.canBeEdited) { |
| 177 this.addEventListener('edit', this.onEditStarted_.bind(this)); | 177 this.addEventListener('edit', this.onEditStarted_.bind(this)); |
| 178 this.addEventListener('canceledit', this.onEditCancelled_.bind(this)); | 178 this.addEventListener('canceledit', this.onEditCancelled_.bind(this)); |
| 179 this.addEventListener('commitedit', this.onEditCommitted_.bind(this)); | 179 this.addEventListener('commitedit', this.onEditCommitted_.bind(this)); |
| 180 } else { | 180 } else { |
| 181 this.editable = false; | 181 this.editable = false; |
| 182 this.querySelector('.row-delete-button').hidden = true; | 182 this.querySelector('.row-delete-button').hidden = true; |
| 183 var indicator = ControlledSettingIndicator(); | 183 var indicator = new ControlledSettingIndicator(); |
| 184 indicator.setAttribute('setting', 'search-engine'); | 184 indicator.setAttribute('setting', 'search-engine'); |
| 185 // Create a synthetic pref change event decorated as | 185 // Create a synthetic pref change event decorated as |
| 186 // CoreOptionsHandler::CreateValueForPref() does. | 186 // CoreOptionsHandler::CreateValueForPref() does. |
| 187 var event = new Event(this.contentType); | 187 var event = new Event(this.contentType); |
| 188 if (engine.extension) { | 188 if (engine.extension) { |
| 189 event.value = { controlledBy: 'extension', | 189 event.value = { controlledBy: 'extension', |
| 190 extension: engine.extension }; | 190 extension: engine.extension }; |
| 191 } else { | 191 } else { |
| 192 event.value = { controlledBy: 'policy' }; | 192 event.value = { controlledBy: 'policy' }; |
| 193 } | 193 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| 249 * chrome.send. The order of the array is important. | 249 * chrome.send. The order of the array is important. |
| 250 * @private | 250 * @private |
| 251 * @return {array} The current input field values. | 251 * @return {Array} The current input field values. |
| 252 */ | 252 */ |
| 253 getInputFieldValues_: function() { | 253 getInputFieldValues_: function() { |
| 254 return [this.nameField_.value, | 254 return [this.nameField_.value, |
| 255 this.keywordField_.value, | 255 this.keywordField_.value, |
| 256 this.urlField_.value]; | 256 this.urlField_.value]; |
| 257 }, | 257 }, |
| 258 | 258 |
| 259 /** | 259 /** |
| 260 * Begins the process of asynchronously validing the input fields. | 260 * Begins the process of asynchronously validing the input fields. |
| 261 * @private | 261 * @private |
| (...skipping 71 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 |