| 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 */ var Page = cr.ui.pageManager.Page; | 6 /** @const */ var Page = cr.ui.pageManager.Page; |
| 7 /** @const */ var PageManager = cr.ui.pageManager.PageManager; | 7 /** @const */ var PageManager = cr.ui.pageManager.PageManager; |
| 8 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; | 8 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 this.extensionList_ = $('extension-keyword-list'); | 55 this.extensionList_ = $('extension-keyword-list'); |
| 56 this.setUpList_(this.extensionList_); | 56 this.setUpList_(this.extensionList_); |
| 57 | 57 |
| 58 $('search-engine-manager-confirm').onclick = function() { | 58 $('search-engine-manager-confirm').onclick = function() { |
| 59 PageManager.closeOverlay(); | 59 PageManager.closeOverlay(); |
| 60 }; | 60 }; |
| 61 }, | 61 }, |
| 62 | 62 |
| 63 /** | 63 /** |
| 64 * Sets up the given list as a search engine list | 64 * Sets up the given list as a search engine list |
| 65 * @param {cr.ui.List} list The list to set up. | 65 * @param {HTMLElement} list The list to set up. |
| 66 * @private | 66 * @private |
| 67 */ | 67 */ |
| 68 setUpList_: function(list) { | 68 setUpList_: function(list) { |
| 69 options.search_engines.SearchEngineList.decorate(list); | 69 options.search_engines.SearchEngineList.decorate(list); |
| 70 list.autoExpands = true; | 70 list.autoExpands = true; |
| 71 }, | 71 }, |
| 72 | 72 |
| 73 /** | 73 /** |
| 74 * Updates the search engine list with the given entries. | 74 * Updates the search engine list with the given entries. |
| 75 * @private | 75 * @private |
| 76 * @param {Array} defaultEngines List of possible default search engines. | 76 * @param {!Array} defaultEngines List of possible default search engines. |
| 77 * @param {Array} otherEngines List of other search engines. | 77 * @param {!Array} otherEngines List of other search engines. |
| 78 * @param {Array} keywords List of keywords from extensions. | 78 * @param {!Array} keywords List of keywords from extensions. |
| 79 */ | 79 */ |
| 80 updateSearchEngineList_: function(defaultEngines, otherEngines, keywords) { | 80 updateSearchEngineList_: function(defaultEngines, otherEngines, keywords) { |
| 81 this.defaultsList_.dataModel = new ArrayDataModel(defaultEngines); | 81 this.defaultsList_.dataModel = new ArrayDataModel(defaultEngines); |
| 82 | 82 |
| 83 otherEngines = otherEngines.map(function(x) { | 83 otherEngines = otherEngines.map(function(x) { |
| 84 return [x, x.name.toLocaleLowerCase()]; | 84 return [x, x.name.toLocaleLowerCase()]; |
| 85 }).sort(function(a, b) { | 85 }).sort(function(a, b) { |
| 86 return a[1].localeCompare(b[1]); | 86 return a[1].localeCompare(b[1]); |
| 87 }).map(function(x) { | 87 }).map(function(x) { |
| 88 return x[0]; | 88 return x[0]; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 validity, modelIndex); | 124 validity, modelIndex); |
| 125 }; | 125 }; |
| 126 | 126 |
| 127 // Export | 127 // Export |
| 128 return { | 128 return { |
| 129 SearchEngineManager: SearchEngineManager | 129 SearchEngineManager: SearchEngineManager |
| 130 }; | 130 }; |
| 131 | 131 |
| 132 }); | 132 }); |
| 133 | 133 |
| OLD | NEW |