Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: chrome/browser/resources/settings/search_engines_page/search_engines_page.js

Issue 2930953002: MD Settings: Sort "other" search engines alphabetically. (Closed)
Patch Set: Add test. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/test/data/webui/settings/search_engines_page_test.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 * @fileoverview 'settings-search-engines-page' is the settings page 6 * @fileoverview 'settings-search-engines-page' is the settings page
7 * containing search engines settings. 7 * containing search engines settings.
8 */ 8 */
9 Polymer({ 9 Polymer({
10 is: 'settings-search-engines-page', 10 is: 'settings-search-engines-page',
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 if (this.showExtensionsList_ && this.$.extensions) 74 if (this.showExtensionsList_ && this.$.extensions)
75 this.$.extensions.notifyResize(); 75 this.$.extensions.notifyResize();
76 }, 76 },
77 77
78 /** 78 /**
79 * @param {!SearchEnginesInfo} searchEnginesInfo 79 * @param {!SearchEnginesInfo} searchEnginesInfo
80 * @private 80 * @private
81 */ 81 */
82 enginesChanged_: function(searchEnginesInfo) { 82 enginesChanged_: function(searchEnginesInfo) {
83 this.defaultEngines = searchEnginesInfo['defaults']; 83 this.defaultEngines = searchEnginesInfo['defaults'];
84 this.otherEngines = searchEnginesInfo['others']; 84
85 // Sort |otherEngines| in alphabetical order.
86 this.otherEngines = searchEnginesInfo['others'].sort(function(a, b) {
87 return a.name.toLocaleLowerCase().localeCompare(
88 b.name.toLocaleLowerCase());
89 });
90
85 this.extensions = searchEnginesInfo['extensions']; 91 this.extensions = searchEnginesInfo['extensions'];
86 }, 92 },
87 93
88 /** 94 /**
89 * @param {!Event} e 95 * @param {!Event} e
90 * @private 96 * @private
91 */ 97 */
92 onAddSearchEngineTap_: function(e) { 98 onAddSearchEngineTap_: function(e) {
93 e.preventDefault(); 99 e.preventDefault();
94 this.showAddSearchEngineDialog_ = true; 100 this.showAddSearchEngineDialog_ = true;
95 this.async(function() { 101 this.async(function() {
96 var dialog = this.$$('settings-search-engine-dialog'); 102 var dialog = this.$$('settings-search-engine-dialog');
97 // Register listener to detect when the dialog is closed. Flip the boolean 103 // Register listener to detect when the dialog is closed. Flip the boolean
98 // once closed to force a restamp next time it is shown such that the 104 // once closed to force a restamp next time it is shown such that the
99 // previous dialog's contents are cleared. 105 // previous dialog's contents are cleared.
100 dialog.addEventListener('close', function() { 106 dialog.addEventListener('close', function() {
101 this.showAddSearchEngineDialog_ = false; 107 this.showAddSearchEngineDialog_ = false;
102 cr.ui.focusWithoutInk(assert(this.$.addSearchEngine)); 108 cr.ui.focusWithoutInk(assert(this.$.addSearchEngine));
103 }.bind(this)); 109 }.bind(this));
104 }.bind(this)); 110 }.bind(this));
105 }, 111 },
106 112
107 /** @private */ 113 /** @private */
108 computeShowExtensionsList_: function() { 114 computeShowExtensionsList_: function() {
109 return this.extensions.length > 0; 115 return this.extensions.length > 0;
110 }, 116 },
111 }); 117 });
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/webui/settings/search_engines_page_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698