Chromium Code Reviews| 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 /** | 5 /** |
| 6 * @typedef {{canBeDefault: boolean, | 6 * @typedef {{canBeDefault: boolean, |
| 7 * canBeEdited: boolean, | 7 * canBeEdited: boolean, |
| 8 * canBeRemoved: boolean, | 8 * canBeRemoved: boolean, |
| 9 * default: boolean, | 9 * default: boolean, |
| 10 * displayName: string, | 10 * displayName: string, |
| 11 * extension: (Object|undefined), | 11 * extension: (Object|undefined), |
| 12 * iconURL: (string|undefined), | 12 * iconURL: (string|undefined), |
| 13 * isExtension: boolean, | 13 * isOmniboxExtension: boolean, |
| 14 * keyword: string, | 14 * keyword: string, |
| 15 * modelIndex: string, | 15 * modelIndex: string, |
| 16 * name: string, | 16 * name: string, |
| 17 * url: string, | 17 * url: string, |
| 18 * urlLocked: boolean}} | 18 * urlLocked: boolean}} |
| 19 * @see chrome/browser/ui/webui/options/search_engine_manager_handler.cc | 19 * @see chrome/browser/ui/webui/options/search_engine_manager_handler.cc |
| 20 */ | 20 */ |
| 21 var SearchEngine; | 21 var SearchEngine; |
| 22 | 22 |
| 23 cr.define('options.search_engines', function() { | 23 cr.define('options.search_engines', function() { |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 134 | 134 |
| 135 // Then the keyword column. | 135 // Then the keyword column. |
| 136 var keywordEl = this.createEditableTextCell(engine.keyword); | 136 var keywordEl = this.createEditableTextCell(engine.keyword); |
| 137 keywordEl.className = 'keyword-column'; | 137 keywordEl.className = 'keyword-column'; |
| 138 keywordEl.classList.add('weakrtl'); | 138 keywordEl.classList.add('weakrtl'); |
| 139 this.contentElement.appendChild(keywordEl); | 139 this.contentElement.appendChild(keywordEl); |
| 140 | 140 |
| 141 // And the URL column. | 141 // And the URL column. |
| 142 var urlEl = this.createEditableTextCell(engine.url); | 142 var urlEl = this.createEditableTextCell(engine.url); |
| 143 // Extensions should not display a URL column. | 143 // Extensions should not display a URL column. |
| 144 if (!engine.isExtension) { | 144 if (!engine.isOmniboxExtension) { |
| 145 var urlWithButtonEl = this.ownerDocument.createElement('div'); | 145 var urlWithButtonEl = this.ownerDocument.createElement('div'); |
| 146 urlWithButtonEl.appendChild(urlEl); | 146 urlWithButtonEl.appendChild(urlEl); |
| 147 urlWithButtonEl.className = 'url-column'; | 147 urlWithButtonEl.className = 'url-column'; |
| 148 urlWithButtonEl.classList.add('weakrtl'); | 148 urlWithButtonEl.classList.add('weakrtl'); |
| 149 this.contentElement.appendChild(urlWithButtonEl); | 149 this.contentElement.appendChild(urlWithButtonEl); |
| 150 // Add the Make Default button. Temporary until drag-and-drop | 150 // Add the Make Default button. Temporary until drag-and-drop |
| 151 // re-ordering is implemented. When this is removed, remove the extra | 151 // re-ordering is implemented. When this is removed, remove the extra |
| 152 // div above. | 152 // div above. |
| 153 if (engine.canBeDefault) { | 153 if (engine.canBeDefault) { |
| 154 var makeDefaultButtonEl = this.ownerDocument.createElement('button'); | 154 var makeDefaultButtonEl = this.ownerDocument.createElement('button'); |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 174 nameEl.querySelector('input')); | 174 nameEl.querySelector('input')); |
| 175 // The editable field uses the raw name, not the display name. | 175 // The editable field uses the raw name, not the display name. |
| 176 this.nameField_.value = engine.name; | 176 this.nameField_.value = engine.name; |
| 177 this.keywordField_ = /** @type {HTMLElement} */( | 177 this.keywordField_ = /** @type {HTMLElement} */( |
| 178 keywordEl.querySelector('input')); | 178 keywordEl.querySelector('input')); |
| 179 this.urlField_ = /** @type {HTMLElement} */(urlEl.querySelector('input')); | 179 this.urlField_ = /** @type {HTMLElement} */(urlEl.querySelector('input')); |
| 180 | 180 |
| 181 if (engine.urlLocked) | 181 if (engine.urlLocked) |
| 182 this.urlField_.disabled = true; | 182 this.urlField_.disabled = true; |
| 183 | 183 |
| 184 if (engine.isExtension) | |
| 185 this.nameField_.disabled = true; | |
|
Dan Beam
2014/10/28 01:36:59
can omnibox extensions be renamed?
vasilii
2014/10/28 14:01:38
No. But this case is handled below. engine.canBeEd
| |
| 186 | |
| 187 if (this.isPlaceholder) { | 184 if (this.isPlaceholder) { |
| 188 this.nameField_.placeholder = | 185 this.nameField_.placeholder = |
| 189 loadTimeData.getString('searchEngineTableNamePlaceholder'); | 186 loadTimeData.getString('searchEngineTableNamePlaceholder'); |
| 190 this.keywordField_.placeholder = | 187 this.keywordField_.placeholder = |
| 191 loadTimeData.getString('searchEngineTableKeywordPlaceholder'); | 188 loadTimeData.getString('searchEngineTableKeywordPlaceholder'); |
| 192 this.urlField_.placeholder = | 189 this.urlField_.placeholder = |
| 193 loadTimeData.getString('searchEngineTableURLPlaceholder'); | 190 loadTimeData.getString('searchEngineTableURLPlaceholder'); |
| 194 } | 191 } |
| 195 | 192 |
| 196 var fields = [this.nameField_, this.keywordField_, this.urlField_]; | 193 var fields = [this.nameField_, this.keywordField_, this.urlField_]; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 366 }, | 363 }, |
| 367 }; | 364 }; |
| 368 | 365 |
| 369 // Export | 366 // Export |
| 370 return { | 367 return { |
| 371 SearchEngineList: SearchEngineList | 368 SearchEngineList: SearchEngineList |
| 372 }; | 369 }; |
| 373 | 370 |
| 374 }); | 371 }); |
| 375 | 372 |
| OLD | NEW |