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

Unified Diff: chrome/browser/resources/settings/search_page/search_page.js

Issue 1125343005: Convert search page to Polymer 0.8. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/settings/search_page/search_page.js
diff --git a/chrome/browser/resources/settings/search_page/search_page.js b/chrome/browser/resources/settings/search_page/search_page.js
index 00c54dd95ad5c1996d097562680c5810ffb0fe72..e66c51ff18e5ca378424c531e891308661495e3a 100644
--- a/chrome/browser/resources/settings/search_page/search_page.js
+++ b/chrome/browser/resources/settings/search_page/search_page.js
@@ -8,95 +8,76 @@
*
* Example:
*
- * <core-animated-pages>
+ * <iron-animated-pages>
* <cr-settings-search-page prefs="{{prefs}}"></cr-settings-search-page>
* ... other pages ...
- * </core-animated-pages>
+ * </iron-animated-pages>
*
* @group Chrome Settings Elements
* @element cr-settings-search-page
*/
-Polymer('cr-settings-search-page', {
- publish: {
+Polymer({
+ is: 'cr-settings-search-page',
+
+ properties: {
/**
* Preferences state.
- *
- * @attribute prefs
- * @type {CrSettingsPrefsElement}
- * @default null
+ * @type {?CrSettingsPrefsElement}
*/
- prefs: null,
+ prefs: {
+ type: Object,
+ notify: true,
+ },
/**
* Route for the page.
- *
- * @attribute route
- * @type {string}
- * @default ''
*/
- route: '',
+ route: String,
/**
* Whether the page is a subpage.
- *
- * @attribute subpage
- * @type {boolean}
- * @default false
*/
- subpage: false,
+ subpage: {
+ type: Boolean,
+ value: false,
+ },
/**
* ID of the page.
- *
- * @attribute PAGE_ID
- * @const {string}
- * @default 'search'
*/
- PAGE_ID: 'search',
+ PAGE_ID: {
+ type: String,
+ value: 'search',
+ },
/**
* Title for the page header and navigation menu.
- *
- * @attribute pageTitle
- * @type {string}
*/
- pageTitle: loadTimeData.getString('searchPageTitle'),
+ pageTitle: {
+ type: String,
+ value: function() { return loadTimeData.getString('searchPageTitle'); },
+ },
/**
- * Name of the 'core-icon' to be shown in the settings-page-header.
- *
- * @attribute icon
- * @type {string}
- * @default 'search'
+ * Name of the 'iron-icon' to be shown in the settings-page-header.
*/
- icon: 'search',
+ icon: {
+ type: Boolean,
+ value: 'search',
+ },
/**
* List of default search engines available.
- *
- * @attribute searchEngines
- * @type {Array<!SearchEngine>}
- * @default null
- */
- searchEngines: null,
-
- /**
- * GUID of the currently selected default search engine.
- *
- * @attribute defaultEngineGuid
- * @type {string}
- * @default ''
+ * @type {?Array<!SearchEngine>}
*/
- defaultEngineGuid: '',
+ searchEngines: {
+ type: Array,
+ value: function() { return []; },
+ },
},
/** @override */
created: function() {
- this.searchEngines = [];
- },
-
- /** @override */
- domReady: function() {
chrome.searchEnginesPrivate.onSearchEnginesChanged.addListener(
this.updateSearchEngines_.bind(this));
chrome.searchEnginesPrivate.getSearchEngines(
@@ -106,9 +87,11 @@ Polymer('cr-settings-search-page', {
/**
* Persists the new default search engine back to Chrome. Called when the
* user selects a new default in the search engines dropdown.
+ * @private
*/
- defaultEngineGuidChanged: function() {
- chrome.searchEnginesPrivate.setSelectedSearchEngine(this.defaultEngineGuid);
+ defaultEngineGuidChanged_: function() {
+ chrome.searchEnginesPrivate.setSelectedSearchEngine(
+ this.$.searchEnginesMenu.value);
},
@@ -125,7 +108,7 @@ Polymer('cr-settings-search-page', {
chrome.searchEnginesPrivate.SearchEngineType.DEFAULT) {
defaultEngines.push(engine);
if (engine.isSelected) {
- this.defaultEngineGuid = engine.guid;
+ this.$.searchEnginesMenu.value = engine.guid;
}
}
}, this);

Powered by Google App Engine
This is Rietveld 408576698