| 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', function() { | 5 cr.define('options', function() { |
| 6 const OptionsPage = options.OptionsPage; | 6 const OptionsPage = options.OptionsPage; |
| 7 const ArrayDataModel = cr.ui.ArrayDataModel; | 7 const ArrayDataModel = cr.ui.ArrayDataModel; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Encapsulated handling of search engine management page. | 10 * Encapsulated handling of search engine management page. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 * @private | 72 * @private |
| 73 * @param {Array} defaultEngines List of possible default search engines. | 73 * @param {Array} defaultEngines List of possible default search engines. |
| 74 * @param {Array} otherEngines List of other search engines. | 74 * @param {Array} otherEngines List of other search engines. |
| 75 * @param {Array} keywords List of keywords from extensions. | 75 * @param {Array} keywords List of keywords from extensions. |
| 76 */ | 76 */ |
| 77 updateSearchEngineList_: function(defaultEngines, otherEngines, keywords) { | 77 updateSearchEngineList_: function(defaultEngines, otherEngines, keywords) { |
| 78 this.defaultsList_.dataModel = new ArrayDataModel(defaultEngines); | 78 this.defaultsList_.dataModel = new ArrayDataModel(defaultEngines); |
| 79 | 79 |
| 80 otherEngines = otherEngines.map(function(x) { | 80 otherEngines = otherEngines.map(function(x) { |
| 81 return [x, x['name'].toLocaleLowerCase()]; | 81 return [x, x['name'].toLocaleLowerCase()]; |
| 82 }).sort(function(a,b){ | 82 }).sort(function(a, b) { |
| 83 return a[1].localeCompare(b[1]); | 83 return a[1].localeCompare(b[1]); |
| 84 }).map(function(x){ | 84 }).map(function(x) { |
| 85 return x[0]; | 85 return x[0]; |
| 86 }); | 86 }); |
| 87 | 87 |
| 88 var othersModel = new ArrayDataModel(otherEngines); | 88 var othersModel = new ArrayDataModel(otherEngines); |
| 89 // Add a "new engine" row. | 89 // Add a "new engine" row. |
| 90 othersModel.push({ | 90 othersModel.push({ |
| 91 'modelIndex': '-1', | 91 'modelIndex': '-1', |
| 92 'canBeEdited': true | 92 'canBeEdited': true |
| 93 }); | 93 }); |
| 94 this.othersList_.dataModel = othersModel; | 94 this.othersList_.dataModel = othersModel; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 120 validity, modelIndex); | 120 validity, modelIndex); |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 // Export | 123 // Export |
| 124 return { | 124 return { |
| 125 SearchEngineManager: SearchEngineManager | 125 SearchEngineManager: SearchEngineManager |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 }); | 128 }); |
| 129 | 129 |
| OLD | NEW |