| 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 = |
| 7 options.ControlledSettingIndicator; |
| 6 /** @const */ var InlineEditableItemList = options.InlineEditableItemList; | 8 /** @const */ var InlineEditableItemList = options.InlineEditableItemList; |
| 7 /** @const */ var InlineEditableItem = options.InlineEditableItem; | 9 /** @const */ var InlineEditableItem = options.InlineEditableItem; |
| 8 /** @const */ var ListSelectionController = cr.ui.ListSelectionController; | 10 /** @const */ var ListSelectionController = cr.ui.ListSelectionController; |
| 9 | 11 |
| 10 /** | 12 /** |
| 11 * Creates a new search engine list item. | 13 * Creates a new search engine list item. |
| 12 * @param {Object} searchEnigne The search engine this represents. | 14 * @param {Object} searchEnigne The search engine this represents. |
| 13 * @constructor | 15 * @constructor |
| 14 * @extends {cr.ui.ListItem} | 16 * @extends {cr.ui.ListItem} |
| 15 */ | 17 */ |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 fields[i].oninput = this.startFieldValidation_.bind(this); | 163 fields[i].oninput = this.startFieldValidation_.bind(this); |
| 162 } | 164 } |
| 163 | 165 |
| 164 // Listen for edit events. | 166 // Listen for edit events. |
| 165 if (engine.canBeEdited) { | 167 if (engine.canBeEdited) { |
| 166 this.addEventListener('edit', this.onEditStarted_.bind(this)); | 168 this.addEventListener('edit', this.onEditStarted_.bind(this)); |
| 167 this.addEventListener('canceledit', this.onEditCancelled_.bind(this)); | 169 this.addEventListener('canceledit', this.onEditCancelled_.bind(this)); |
| 168 this.addEventListener('commitedit', this.onEditCommitted_.bind(this)); | 170 this.addEventListener('commitedit', this.onEditCommitted_.bind(this)); |
| 169 } else { | 171 } else { |
| 170 this.editable = false; | 172 this.editable = false; |
| 173 this.querySelector('.row-delete-button').hidden = true; |
| 174 var indicator = ControlledSettingIndicator(); |
| 175 indicator.setAttribute('setting', 'search-engine'); |
| 176 // Create a synthetic pref change event decorated as |
| 177 // CoreOptionsHandler::CreateValueForPref() does. |
| 178 var event = new cr.Event(this.contentType); |
| 179 event.value = { controlledBy: 'policy' }; |
| 180 indicator.handlePrefChange(event); |
| 181 this.appendChild(indicator); |
| 171 } | 182 } |
| 172 }, | 183 }, |
| 173 | 184 |
| 174 /** @inheritDoc */ | 185 /** @inheritDoc */ |
| 175 get currentInputIsValid() { | 186 get currentInputIsValid() { |
| 176 return !this.waitingForValidation_ && this.currentlyValid_; | 187 return !this.waitingForValidation_ && this.currentlyValid_; |
| 177 }, | 188 }, |
| 178 | 189 |
| 179 /** @inheritDoc */ | 190 /** @inheritDoc */ |
| 180 get hasBeenEdited() { | 191 get hasBeenEdited() { |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 }, | 319 }, |
| 309 }; | 320 }; |
| 310 | 321 |
| 311 // Export | 322 // Export |
| 312 return { | 323 return { |
| 313 SearchEngineList: SearchEngineList | 324 SearchEngineList: SearchEngineList |
| 314 }; | 325 }; |
| 315 | 326 |
| 316 }); | 327 }); |
| 317 | 328 |
| OLD | NEW |