| OLD | NEW |
| 1 // Copyright (c) 2011 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. |
| 11 * @constructor | 11 * @constructor |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 * @private | 68 * @private |
| 69 * @param {Array} defaultEngines List of possible default search engines. | 69 * @param {Array} defaultEngines List of possible default search engines. |
| 70 * @param {Array} otherEngines List of other search engines. | 70 * @param {Array} otherEngines List of other search engines. |
| 71 * @param {Array} keywords List of keywords from extensions. | 71 * @param {Array} keywords List of keywords from extensions. |
| 72 */ | 72 */ |
| 73 updateSearchEngineList_: function(defaultEngines, otherEngines, keywords) { | 73 updateSearchEngineList_: function(defaultEngines, otherEngines, keywords) { |
| 74 this.defaultsList_.dataModel = new ArrayDataModel(defaultEngines); | 74 this.defaultsList_.dataModel = new ArrayDataModel(defaultEngines); |
| 75 | 75 |
| 76 otherEngines = otherEngines.map(function(x) { | 76 otherEngines = otherEngines.map(function(x) { |
| 77 return [x, x['name'].toLocaleLowerCase()]; | 77 return [x, x['name'].toLocaleLowerCase()]; |
| 78 }).sort(function(a,b){ | 78 }).sort(function(a, b) { |
| 79 return a[1].localeCompare(b[1]); | 79 return a[1].localeCompare(b[1]); |
| 80 }).map(function(x){ | 80 }).map(function(x) { |
| 81 return x[0]; | 81 return x[0]; |
| 82 }); | 82 }); |
| 83 | 83 |
| 84 var othersModel = new ArrayDataModel(otherEngines); | 84 var othersModel = new ArrayDataModel(otherEngines); |
| 85 // Add a "new engine" row. | 85 // Add a "new engine" row. |
| 86 othersModel.push({ | 86 othersModel.push({ |
| 87 'modelIndex': '-1', | 87 'modelIndex': '-1', |
| 88 'canBeEdited': true | 88 'canBeEdited': true |
| 89 }); | 89 }); |
| 90 this.othersList_.dataModel = othersModel; | 90 this.othersList_.dataModel = othersModel; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 116 validity, modelIndex); | 116 validity, modelIndex); |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 // Export | 119 // Export |
| 120 return { | 120 return { |
| 121 SearchEngineManager: SearchEngineManager | 121 SearchEngineManager: SearchEngineManager |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 }); | 124 }); |
| 125 | 125 |
| OLD | NEW |