Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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. | |
| 4 | |
| 5 /** | |
| 6 * @fileoverview | |
| 7 * 'cr-settings-search-page' is the settings page containing search settings. | |
| 8 * | |
| 9 * Example: | |
| 10 * | |
| 11 * <core-animated-pages> | |
| 12 * <cr-settings-search-page prefs="{{prefs}}"></cr-settings-search-page> | |
| 13 * ... other pages ... | |
| 14 * </core-animated-pages> | |
| 15 * | |
| 16 * @group Chrome Settings Elements | |
| 17 * @element cr-settings-search-page | |
| 18 */ | |
| 19 Polymer('cr-settings-search-page', { | |
| 20 publish: { | |
| 21 /** | |
| 22 * Preferences state. | |
| 23 * | |
| 24 * @attribute prefs | |
| 25 * @type CrSettingsPrefsElement | |
| 26 * @default null | |
| 27 */ | |
| 28 prefs: null, | |
| 29 | |
| 30 /** | |
| 31 * Whether the page is a subpage. | |
| 32 * | |
| 33 * @attribute subpage | |
| 34 * @type boolean | |
| 35 * @default false | |
| 36 */ | |
| 37 subpage: false, | |
| 38 | |
| 39 /** | |
| 40 * ID of the page. | |
| 41 * | |
| 42 * @attribute PAGE_ID | |
| 43 * @const string | |
| 44 * @default 'search' | |
| 45 */ | |
| 46 PAGE_ID: 'search', | |
| 47 | |
| 48 /** | |
| 49 * Title for the page header and navigation menu. | |
| 50 * | |
| 51 * @attribute pageTitle | |
| 52 * @type string | |
| 53 */ | |
| 54 pageTitle: loadTimeData.getString('searchPageTitle'), | |
| 55 | |
| 56 /** | |
| 57 * Name of the 'core-icon' to show. | |
|
Jeremy Klein
2015/04/22 17:37:46
nit: ... in the page header.
Oren Blasberg
2015/04/22 18:25:41
Done.
| |
| 58 * | |
| 59 * @attribute icon | |
| 60 * @type string | |
| 61 * @default 'search' | |
| 62 */ | |
| 63 icon: 'search', | |
| 64 | |
| 65 /** | |
| 66 * List of default search engines available. | |
| 67 * | |
| 68 * @attribute searchEngines | |
| 69 * @type Array | |
|
Jeremy Klein
2015/04/22 17:37:46
I know all of our types don't have {} right now, b
Jeremy Klein
2015/04/22 17:37:46
!Array<!chrome.searchEnginesPrivate.SearchEngine>,
Oren Blasberg
2015/04/22 18:25:41
Done.
| |
| 70 * @default [] | |
| 71 */ | |
| 72 searchEngines: [], | |
|
Jeremy Klein
2015/04/22 17:37:46
Array and Object properties should be initialized
Oren Blasberg
2015/04/22 18:25:41
Done.
| |
| 73 | |
| 74 /** | |
| 75 * GUID of the currently selected default search engine. | |
| 76 * | |
| 77 * @attribute defaultEngineGuid | |
| 78 * @type string | |
| 79 * @default '' | |
| 80 */ | |
| 81 defaultEngineGuid: '', | |
| 82 }, | |
| 83 | |
| 84 domReady: function() { | |
|
Jeremy Klein
2015/04/22 17:37:46
@override
Jeremy Klein
2015/04/22 17:37:46
I think this could just be done in attached or rea
Oren Blasberg
2015/04/22 18:25:41
Done.
| |
| 85 chrome.searchEnginesPrivate.onSearchEnginesChanged.addListener( | |
| 86 this.updateSearchEngines_.bind(this)); | |
| 87 chrome.searchEnginesPrivate.getDefaultSearchEngines( | |
| 88 this.updateSearchEngines_.bind(this)); | |
| 89 }, | |
| 90 | |
| 91 defaultEngineGuidChanged: function() { | |
|
Jeremy Klein
2015/04/22 17:37:46
Can you add a jsdoc just to clarify that this is c
Oren Blasberg
2015/04/22 18:25:41
Done.
| |
| 92 chrome.searchEnginesPrivate.setDefaultSearchEngine(this.defaultEngineGuid); | |
| 93 }, | |
| 94 | |
| 95 | |
| 96 /** | |
| 97 * Updates the list of search engines with the given |engines|. | |
| 98 * @param {!Array<!chrome.searchEnginesPrivate.SearchEngine>} engines | |
| 99 * @private | |
| 100 */ | |
| 101 updateSearchEngines_: function(engines) { | |
| 102 this.searchEngines = engines; | |
| 103 for (var i = 0; i < engines.length; i++) { | |
| 104 if (engines[i].isDefault) { | |
| 105 this.defaultEngineGuid = engines[i].guid; | |
| 106 } | |
| 107 } | |
| 108 } | |
| 109 }); | |
| OLD | NEW |