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

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

Issue 1141603003: Convert cr-settings-main to Polymer 0.8 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: oops, remove structure 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/settings_main/settings_main.js
diff --git a/chrome/browser/resources/settings/settings_main/settings_main.js b/chrome/browser/resources/settings/settings_main/settings_main.js
index cb35b8d411651eefa56126b4dd69cdbd841c97df..3e020709bb10fe9c1513251feca560212bf82e43 100644
--- a/chrome/browser/resources/settings/settings_main/settings_main.js
+++ b/chrome/browser/resources/settings/settings_main/settings_main.js
@@ -8,47 +8,51 @@
*
* Example:
*
- * <cr-settings-main pages="{{pages}}" selectedPageId="{{selectedId}}">
+ * <cr-settings-main pages="[[pages]]" selected-page-id="{{selectedId}}">
* </cr-settings-main>
*
- * See cr-settings-drawer for example of use in 'core-drawer-panel'.
+ * See cr-settings-drawer for example of use in 'paper-drawer-panel'.
*
* @group Chrome Settings Elements
* @element cr-settings-main
*/
-Polymer('cr-settings-main', {
- publish: {
+Polymer({
+ is: 'cr-settings-main',
+
+ properties: {
/**
* Preferences state.
*
- * @attribute prefs
- * @type CrSettingsPrefsElement
- * @default null
+ * @type {?CrSettingsPrefsElement}
*/
- prefs: null,
+ prefs: {
+ type: Object,
+ notify: true,
+ },
/**
* Pages that may be shown.
- *
- * @attribute pages
- * @type Array<!Object>
- * @default null
+ * @type {?Array<!HTMLElement>}
*/
- pages: null,
+ pages: Array,
/**
- * ID of the currently selected page.
- *
- * @attribute selectedPageId
- * @type string
- * default ''
+ * Currently selected page.
+ * @type {?HTMLElement}
*/
- selectedPageId: '',
- },
+ selectedPage: {
+ type: Object,
+ notify: true,
+ },
- /** @override */
- created: function() {
- this.pages = [];
+ /**
+ * ID of the currently selected page.
+ */
+ selectedPageId: {
+ type: String,
+ notify: true,
+ observe: 'selectedPageIdChanged_',
+ },
},
/** @override */
@@ -62,14 +66,15 @@ Polymer('cr-settings-main', {
},
/**
- * Polymer changed event for selectedPageId. See note for onCoreSelect_ below.
+ * Polymer changed event for selectedPageId. See note for onIronSelect_ below.
+ * @private
*/
- selectedPageIdChanged: function() {
+ selectedPageIdChanged_: function() {
this.$.pageContainer.selected = this.selectedPageId;
},
/**
- * We observe $.pageContainer.on-core-select instead of using data binding
+ * We observe $.pageContainer.on-iron-select instead of using data binding
* for two reasons:
* 1) We need to exclude subpages
* 2) There is a bug with data binding or our useage of it here causing
@@ -78,7 +83,7 @@ Polymer('cr-settings-main', {
* fixing this and using filters once we switch to Polymer 0.8.
* @private
*/
- onCoreSelect_: function(event) {
+ onIronSelect_: function(event) {
if (event.target != this.$.pageContainer || !event.detail.isSelected ||
event.detail.item.subpage) {
return;
@@ -89,7 +94,6 @@ Polymer('cr-settings-main', {
/**
* If no page is selected, selects the first page. This happens on load and
* when a selected page is removed.
- *
* @private
*/
ensureSelection_: function() {
@@ -100,8 +104,7 @@ Polymer('cr-settings-main', {
},
/**
- * Updates the list of pages using the pages in core-animated-pages.
- *
+ * Updates the list of pages using the pages in iron-pages.
* @private
*/
pageContainerUpdated_: function() {

Powered by Google App Engine
This is Rietveld 408576698