OLD | NEW |
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 29 matching lines...) Expand all Loading... |
40 ready: function() { | 40 ready: function() { |
41 var updateSearchEngines = function(searchEngines) { | 41 var updateSearchEngines = function(searchEngines) { |
42 this.set('searchEngines_', searchEngines.defaults); | 42 this.set('searchEngines_', searchEngines.defaults); |
43 }.bind(this); | 43 }.bind(this); |
44 this.browserProxy_.getSearchEnginesList().then(updateSearchEngines); | 44 this.browserProxy_.getSearchEnginesList().then(updateSearchEngines); |
45 cr.addWebUIListener('search-engines-changed', updateSearchEngines); | 45 cr.addWebUIListener('search-engines-changed', updateSearchEngines); |
46 }, | 46 }, |
47 | 47 |
48 /** @private */ | 48 /** @private */ |
49 onManageSearchEnginesTap_: function() { | 49 onManageSearchEnginesTap_: function() { |
50 this.$.pages.setSubpageChain(['search-engines']); | 50 settings.navigateTo(settings.Route.SEARCH_ENGINES); |
51 }, | 51 }, |
52 | 52 |
53 /** @private */ | 53 /** @private */ |
54 onIronSelect_: function() { | 54 onIronSelect_: function() { |
55 var searchEngine = this.searchEngines_[this.$$('paper-listbox').selected]; | 55 var searchEngine = this.searchEngines_[this.$$('paper-listbox').selected]; |
56 if (searchEngine.default) { | 56 if (searchEngine.default) { |
57 // If the selected search engine is already marked as the default one, | 57 // If the selected search engine is already marked as the default one, |
58 // this change originated in some other tab, and nothing should be done | 58 // this change originated in some other tab, and nothing should be done |
59 // here. | 59 // here. |
60 return; | 60 return; |
61 } | 61 } |
62 | 62 |
63 // Otherwise, this change originated by an explicit user action in this tab. | 63 // Otherwise, this change originated by an explicit user action in this tab. |
64 // Submit the default search engine change. | 64 // Submit the default search engine change. |
65 this.browserProxy_.setDefaultSearchEngine(searchEngine.modelIndex); | 65 this.browserProxy_.setDefaultSearchEngine(searchEngine.modelIndex); |
66 }, | 66 }, |
67 | 67 |
68 /** | 68 /** |
69 * @return {number} | 69 * @return {number} |
70 * @private | 70 * @private |
71 */ | 71 */ |
72 getSelectedSearchEngineIndex_: function() { | 72 getSelectedSearchEngineIndex_: function() { |
73 return this.searchEngines_.findIndex(function(searchEngine) { | 73 return this.searchEngines_.findIndex(function(searchEngine) { |
74 return searchEngine.default; | 74 return searchEngine.default; |
75 }); | 75 }); |
76 }, | 76 }, |
77 }); | 77 }); |
OLD | NEW |