| Index: chrome/browser/resources/options/search_engine_manager.js
|
| diff --git a/chrome/browser/resources/options/search_engine_manager.js b/chrome/browser/resources/options/search_engine_manager.js
|
| index d0b50f8abdfa06003d3776ae45a977cceca07551..ea87ebd3dc6145334f1ef46682b67342ca3901da 100644
|
| --- a/chrome/browser/resources/options/search_engine_manager.js
|
| +++ b/chrome/browser/resources/options/search_engine_manager.js
|
| @@ -22,39 +22,73 @@ cr.define('options', function() {
|
|
|
| SearchEngineManager.prototype = {
|
| __proto__: OptionsPage.prototype,
|
| - list_: null,
|
|
|
| + /**
|
| + * List for default search engine options
|
| + * @type {boolean}
|
| + * @private
|
| + */
|
| + defaultsList_: null,
|
| +
|
| + /**
|
| + * List for other search engine options
|
| + * @type {boolean}
|
| + * @private
|
| + */
|
| + othersList_: null,
|
| +
|
| + /** inheritDoc */
|
| initializePage: function() {
|
| OptionsPage.prototype.initializePage.call(this);
|
|
|
| - this.list_ = $('searchEngineList')
|
| - options.search_engines.SearchEngineList.decorate(this.list_);
|
| - var selectionModel = new ListSingleSelectionModel;
|
| - this.list_.selectionModel = selectionModel;
|
| - this.list_.autoExpands = true;
|
| + this.defaultsList_ = $('defaultSearchEngineList');
|
| + this.setUpList_(this.defaultsList_);
|
| +
|
| + this.othersList_ = $('otherSearchEngineList');
|
| + this.setUpList_(this.othersList_);
|
| + },
|
| +
|
| + /**
|
| + * Sets up the given list as a search engine list
|
| + * @param {List} list The list to set up.
|
| + * @private
|
| + */
|
| + setUpList_: function(list) {
|
| + options.search_engines.SearchEngineList.decorate(list);
|
| + list.selectionModel = new ListSingleSelectionModel;
|
| + list.autoExpands = true;
|
| },
|
|
|
| /**
|
| * Updates the search engine list with the given entries.
|
| * @private
|
| - * @param {Array} engineList List of available search engines.
|
| + * @param {Array} defaultEngines List of possible default search engines.
|
| + * @param {Array} otherEngines List of other search engines.
|
| */
|
| - updateSearchEngineList_: function(engineList) {
|
| - var model = new ArrayDataModel(engineList);
|
| - model.push({
|
| + updateSearchEngineList_: function(defaultEngines, otherEngines) {
|
| + this.defaultsList_.dataModel = new ArrayDataModel(defaultEngines);
|
| + var othersModel = new ArrayDataModel(otherEngines);
|
| + // Add a "new engine" row.
|
| + othersModel.push({
|
| 'modelIndex': '-1'
|
| });
|
| - this.list_.dataModel = model;
|
| + this.othersList_.dataModel = othersModel;
|
| },
|
| };
|
|
|
| - SearchEngineManager.updateSearchEngineList = function(engineList) {
|
| - SearchEngineManager.getInstance().updateSearchEngineList_(engineList);
|
| + SearchEngineManager.updateSearchEngineList = function(defaultEngines,
|
| + otherEngines) {
|
| + SearchEngineManager.getInstance().updateSearchEngineList_(defaultEngines,
|
| + otherEngines);
|
| };
|
|
|
| SearchEngineManager.validityCheckCallback = function(validity, modelIndex) {
|
| - SearchEngineManager.getInstance().list_.validationComplete(validity,
|
| - modelIndex);
|
| + // Forward to both lists; the one without a matching modelIndex will ignore
|
| + // it.
|
| + SearchEngineManager.getInstance().defaultsList_.validationComplete(
|
| + validity, modelIndex);
|
| + SearchEngineManager.getInstance().othersList_.validationComplete(
|
| + validity, modelIndex);
|
| };
|
|
|
| // Export
|
|
|