OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 ListInlineHeaderSelectionController = | 8 const ListInlineHeaderSelectionController = |
9 options.ListInlineHeaderSelectionController; | 9 options.ListInlineHeaderSelectionController; |
10 | 10 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 nameColEl.appendChild(nameEl); | 127 nameColEl.appendChild(nameEl); |
128 | 128 |
129 // Then the keyword column. | 129 // Then the keyword column. |
130 var keywordEl = this.createEditableTextCell(keywordText, | 130 var keywordEl = this.createEditableTextCell(keywordText, |
131 this.isPlaceholder_); | 131 this.isPlaceholder_); |
132 keywordEl.className = 'keyword-column'; | 132 keywordEl.className = 'keyword-column'; |
133 this.contentElement.appendChild(keywordEl); | 133 this.contentElement.appendChild(keywordEl); |
134 | 134 |
135 // And the URL column. | 135 // And the URL column. |
136 var urlEl = this.createEditableTextCell(urlText, this.isPlaceholder_); | 136 var urlEl = this.createEditableTextCell(urlText, this.isPlaceholder_); |
137 urlEl.className = 'url-column'; | 137 var urlWithButtonEl = this.ownerDocument.createElement('div'); |
138 this.contentElement.appendChild(urlEl); | 138 urlWithButtonEl.appendChild(urlEl); |
| 139 urlWithButtonEl.className = 'url-column'; |
| 140 this.contentElement.appendChild(urlWithButtonEl); |
| 141 // Add the Make Default button. Temporary until drag-and-drop re-ordering |
| 142 // is implemented. When this is removed, remove the extra div above. |
| 143 if (engine['canBeDefault']) { |
| 144 var makeDefaultButtonEl = this.ownerDocument.createElement('button'); |
| 145 makeDefaultButtonEl.textContent = |
| 146 templateData.makeDefaultSearchEngineButton; |
| 147 makeDefaultButtonEl.onclick = function(e) { |
| 148 chrome.send('managerSetDefaultSearchEngine', [engine['modelIndex']]); |
| 149 }; |
| 150 // Don't select the row when clicking the button. |
| 151 makeDefaultButtonEl.onmousedown = function(e) { |
| 152 e.stopPropagation(); |
| 153 }; |
| 154 urlWithButtonEl.appendChild(makeDefaultButtonEl); |
| 155 } |
139 | 156 |
140 // Do final adjustment to the input fields. | 157 // Do final adjustment to the input fields. |
141 if (!engine['heading']) { | 158 if (!engine['heading']) { |
142 this.nameField_ = nameEl.querySelector('input'); | 159 this.nameField_ = nameEl.querySelector('input'); |
143 this.keywordField_ = keywordEl.querySelector('input'); | 160 this.keywordField_ = keywordEl.querySelector('input'); |
144 this.urlField_ = urlEl.querySelector('input'); | 161 this.urlField_ = urlEl.querySelector('input'); |
145 | 162 |
146 if (engine['urlLocked']) | 163 if (engine['urlLocked']) |
147 this.urlField_.disabled = true; | 164 this.urlField_.disabled = true; |
148 | 165 |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 }, | 336 }, |
320 }; | 337 }; |
321 | 338 |
322 // Export | 339 // Export |
323 return { | 340 return { |
324 SearchEngineList: SearchEngineList | 341 SearchEngineList: SearchEngineList |
325 }; | 342 }; |
326 | 343 |
327 }); | 344 }); |
328 | 345 |
OLD | NEW |