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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 makeDefaultButtonEl.onclick = function(e) { | 132 makeDefaultButtonEl.onclick = function(e) { |
131 chrome.send('managerSetDefaultSearchEngine', [engine.modelIndex]); | 133 chrome.send('managerSetDefaultSearchEngine', [engine.modelIndex]); |
132 }; | 134 }; |
133 // Don't select the row when clicking the button. | 135 // Don't select the row when clicking the button. |
134 makeDefaultButtonEl.onmousedown = function(e) { | 136 makeDefaultButtonEl.onmousedown = function(e) { |
135 e.stopPropagation(); | 137 e.stopPropagation(); |
136 }; | 138 }; |
137 urlWithButtonEl.appendChild(makeDefaultButtonEl); | 139 urlWithButtonEl.appendChild(makeDefaultButtonEl); |
138 } | 140 } |
139 | 141 |
| 142 if (engine.controlledBy == 'policy') { |
| 143 this.querySelector('.row-delete-button').hidden = true; |
| 144 var indicator = ControlledSettingIndicator(); |
| 145 indicator.setAttribute('setting', 'search-engine'); |
| 146 // Create a synthetic pref change event decorated as |
| 147 // CoreOptionsHandler::CreateValueForPref() does. |
| 148 var event = new cr.Event(this.contentType); |
| 149 event.value = { controlledBy: engine.controlledBy }; |
| 150 indicator.handlePrefChange(event); |
| 151 this.appendChild(indicator); |
| 152 } |
| 153 |
140 // Do final adjustment to the input fields. | 154 // Do final adjustment to the input fields. |
141 this.nameField_ = nameEl.querySelector('input'); | 155 this.nameField_ = nameEl.querySelector('input'); |
142 // The editable field uses the raw name, not the display name. | 156 // The editable field uses the raw name, not the display name. |
143 this.nameField_.value = engine.name; | 157 this.nameField_.value = engine.name; |
144 this.keywordField_ = keywordEl.querySelector('input'); | 158 this.keywordField_ = keywordEl.querySelector('input'); |
145 this.urlField_ = urlEl.querySelector('input'); | 159 this.urlField_ = urlEl.querySelector('input'); |
146 | 160 |
147 if (engine.urlLocked) | 161 if (engine.urlLocked) |
148 this.urlField_.disabled = true; | 162 this.urlField_.disabled = true; |
149 | 163 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 }, | 322 }, |
309 }; | 323 }; |
310 | 324 |
311 // Export | 325 // Export |
312 return { | 326 return { |
313 SearchEngineList: SearchEngineList | 327 SearchEngineList: SearchEngineList |
314 }; | 328 }; |
315 | 329 |
316 }); | 330 }); |
317 | 331 |
OLD | NEW |