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

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

Issue 2378253003: MD Settings: Search page, switching paper-dropdown-menu to native select. (Closed)
Patch Set: Merge conflicts. Created 4 years, 2 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
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 6 * @fileoverview
7 * 'settings-search-page' is the settings page containing search settings. 7 * 'settings-search-page' is the settings page containing search settings.
8 */ 8 */
9 Polymer({ 9 Polymer({
10 is: 'settings-search-page', 10 is: 'settings-search-page',
(...skipping 25 matching lines...) Expand all
36 this.browserProxy_.getSearchEnginesList().then(updateSearchEngines); 36 this.browserProxy_.getSearchEnginesList().then(updateSearchEngines);
37 cr.addWebUIListener('search-engines-changed', updateSearchEngines); 37 cr.addWebUIListener('search-engines-changed', updateSearchEngines);
38 }, 38 },
39 39
40 /** @private */ 40 /** @private */
41 onManageSearchEnginesTap_: function() { 41 onManageSearchEnginesTap_: function() {
42 settings.navigateTo(settings.Route.SEARCH_ENGINES); 42 settings.navigateTo(settings.Route.SEARCH_ENGINES);
43 }, 43 },
44 44
45 /** @private */ 45 /** @private */
46 onIronSelect_: function() { 46 onChange_: function(e) {
47 var searchEngine = this.searchEngines_[this.$$('paper-listbox').selected]; 47 var select = /** @type {!HTMLSelectElement} */ (this.$$('select'));
48 if (searchEngine.default) { 48 var searchEngine = this.searchEngines_[select.selectedIndex];
49 // If the selected search engine is already marked as the default one,
50 // this change originated in some other tab, and nothing should be done
51 // here.
52 return;
53 }
54
55 // Otherwise, this change originated by an explicit user action in this tab.
56 // Submit the default search engine change.
57 this.browserProxy_.setDefaultSearchEngine(searchEngine.modelIndex); 49 this.browserProxy_.setDefaultSearchEngine(searchEngine.modelIndex);
58 }, 50 },
59
60 /**
61 * @return {number}
62 * @private
63 */
64 getSelectedSearchEngineIndex_: function() {
65 return this.searchEngines_.findIndex(function(searchEngine) {
66 return searchEngine.default;
67 });
68 },
69 }); 51 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/search_page/search_page.html ('k') | chrome/browser/resources/settings/select_css.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698