[Eraser strings] Remove unused Supervised User infobar and corresponding strings
[chromium-blink-merge.git] / chrome / browser / resources / settings / search_page / search_page.js
blobf0b9fc4bde1f9a8f0f1f869f176f0ba37b3da1d6
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
3 // found in the LICENSE file.
5 /**
6 * @fileoverview
7 * 'cr-settings-search-page' is the settings page containing search settings.
9 * Example:
11 * <iron-animated-pages>
12 * <cr-settings-search-page prefs="{{prefs}}"></cr-settings-search-page>
13 * ... other pages ...
14 * </iron-animated-pages>
16 * @group Chrome Settings Elements
17 * @element cr-settings-search-page
19 Polymer({
20 is: 'cr-settings-search-page',
22 properties: {
23 /**
24 * Route for the page.
26 route: String,
28 /**
29 * Whether the page is a subpage.
31 subpage: {
32 type: Boolean,
33 value: false,
36 /**
37 * ID of the page.
39 PAGE_ID: {
40 type: String,
41 value: 'search',
44 /**
45 * Title for the page header and navigation menu.
47 pageTitle: {
48 type: String,
49 value: function() { return loadTimeData.getString('searchPageTitle'); },
52 /**
53 * Name of the 'iron-icon' to be shown in the settings-page-header.
55 icon: {
56 type: Boolean,
57 value: 'search',
60 /**
61 * List of default search engines available.
62 * @type {?Array<!SearchEngine>}
64 searchEngines: {
65 type: Array,
66 value: function() { return []; },
69 inSubpage: {
70 type: Boolean,
71 notify: true,
75 /** @override */
76 created: function() {
77 chrome.searchEnginesPrivate.onSearchEnginesChanged.addListener(
78 this.updateSearchEngines_.bind(this));
79 chrome.searchEnginesPrivate.getSearchEngines(
80 this.updateSearchEngines_.bind(this));
83 /**
84 * Persists the new default search engine back to Chrome. Called when the
85 * user selects a new default in the search engines dropdown.
86 * @private
88 defaultEngineGuidChanged_: function() {
89 chrome.searchEnginesPrivate.setSelectedSearchEngine(
90 this.$.searchEnginesMenu.value);
94 /**
95 * Updates the list of default search engines based on the given |engines|.
96 * @param {!Array<!SearchEngine>} engines All the search engines.
97 * @private
99 updateSearchEngines_: function(engines) {
100 var defaultEngines = [];
102 engines.forEach(function(engine) {
103 if (engine.type ==
104 chrome.searchEnginesPrivate.SearchEngineType.DEFAULT) {
105 defaultEngines.push(engine);
106 if (engine.isSelected) {
107 this.$.searchEnginesMenu.value = engine.guid;
110 }, this);
112 this.searchEngines = defaultEngines;
115 /** @private */
116 manageSearchEngines_: function() {
117 this.$.pages.navigateTo('search-engines');
120 /** @private */
121 handleBack_: function() {
122 this.$.pages.back();