Commit f8682c06 authored by michaelpg's avatar michaelpg Committed by Commit bot

Convert cr-settings-main to Polymer 0.8

This hasn't been thoroughly tested yet. Once more pages are ready
and the rest of the structure is in place I will look more closely
at how pages are selected

BUG=485381

Review URL: https://codereview.chromium.org/1141603003

Cr-Commit-Position: refs/heads/master@{#329485}
parent 9b015b54
<link rel="import" href="chrome://resources/polymer/polymer/polymer.html"> /* Copyright 2015 The Chromium Authors. All rights reserved.
<link rel="import" href="chrome://resources/polymer/core-style/core-style.html"> * Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file. */
<core-style id="settingsMainStyle">
:host { :host {
background-color: rgb(219, 222, 224); background-color: rgb(219, 222, 224);
color: black; color: black;
...@@ -22,4 +22,3 @@ ...@@ -22,4 +22,3 @@
::content core-icon-button { ::content core-icon-button {
position: absolute; position: absolute;
} }
</core-style>
<link rel="import" href="chrome://resources/polymer/polymer/polymer.html"> <link rel="import" href="chrome://resources/polymer/v0_8/polymer/polymer.html">
<link rel="import" href="chrome://resources/polymer/core-animated-pages/core-animated-pages.html"> <link rel="import" href="chrome://resources/polymer/v0_8/iron-pages/iron-pages.html">
<link rel="import" href="chrome://resources/polymer/core-transition/core-transition.html"> <link rel="import" href="chrome://md-settings/routes.html">
<link rel="import" href="chrome://resources/polymer/paper-shadow/paper-shadow.html">
<!-- TODO: Uncomment pages as they are upgraded.
<link rel="import" href="chrome://md-settings/a11y_page/a11y_page.html"> <link rel="import" href="chrome://md-settings/a11y_page/a11y_page.html">
<link rel="import" href="chrome://md-settings/date_time_page/date_time_page.html"> <link rel="import" href="chrome://md-settings/date_time_page/date_time_page.html">
<link rel="import" href="chrome://md-settings/downloads_page/downloads_page.html"> <link rel="import" href="chrome://md-settings/downloads_page/downloads_page.html">
...@@ -9,41 +10,54 @@ ...@@ -9,41 +10,54 @@
<link rel="import" href="chrome://md-settings/internet_page/internet_detail_page.html"> <link rel="import" href="chrome://md-settings/internet_page/internet_detail_page.html">
<link rel="import" href="chrome://md-settings/search_engines_page/search_engines_page.html"> <link rel="import" href="chrome://md-settings/search_engines_page/search_engines_page.html">
<link rel="import" href="chrome://md-settings/search_page/search_page.html"> <link rel="import" href="chrome://md-settings/search_page/search_page.html">
<link rel="import" href="chrome://md-settings/routes.html"> -->
<link rel="import" href="settings_main_style.html">
<polymer-element name="cr-settings-main"> <dom-module id="cr-settings-main">
<link rel="import" type="css" href="settings_main.css">
<template> <template>
<core-style ref="settingsMainStyle"></core-style>
<div id="mainContainer"> <div id="mainContainer">
<cr-settings-page-header selectedPage="{{$.pageContainer.selectedItem}}"> <cr-settings-page-header selected-page="[[selectedPage]]">
</cr-settings-page-header> </cr-settings-page-header>
<content select="core-icon-button"></content> <content select="paper-icon-button"></content>
<more-route-selector selectedParams="{{params}}"> <more-route-selector selected-params="{{params}}">
<core-animated-pages id="pageContainer" <iron-pages id="pageContainer" selected-item="{{selectedPage}}"
on-core-select="{{onCoreSelect_}}" valueattr="PAGE_ID" on-iron-select="onIronSelect_" attr-for-selected="PAGE_ID">
transitions="cross-fade"> <!-- TODO: Uncomment pages as they are upgraded. -->
<if expr="chromeos"> <if expr="chromeos">
<!--
<cr-settings-internet-page route="internet"> <cr-settings-internet-page route="internet">
</cr-settings-internet-page> </cr-settings-internet-page>
-->
<!--
<cr-settings-internet-detail-page route="internet-detail" <cr-settings-internet-detail-page route="internet-detail"
subpage="true" guid="{{params.guid}}"> subpage="true" guid="{{params.guid}}">
</cr-settings-internet-detail-page> </cr-settings-internet-detail-page>
-->
</if> </if>
<!--
<cr-settings-a11y-page prefs="{{prefs}}" route="a11y"> <cr-settings-a11y-page prefs="{{prefs}}" route="a11y">
</cr-settings-a11y-page> </cr-settings-a11y-page>
-->
<if expr="chromeos"> <if expr="chromeos">
<!--
<cr-settings-date-time-page prefs="{{prefs}}" route="dateTime"> <cr-settings-date-time-page prefs="{{prefs}}" route="dateTime">
</cr-settings-date-time-page> </cr-settings-date-time-page>
</if> </if>
-->
<!--
<cr-settings-downloads-page prefs="{{prefs}}" route="downloads"> <cr-settings-downloads-page prefs="{{prefs}}" route="downloads">
</cr-settings-downloads-page> </cr-settings-downloads-page>
-->
<!--
<cr-settings-search-page prefs="{{prefs}}" route="search"> <cr-settings-search-page prefs="{{prefs}}" route="search">
</cr-settings-search-page> </cr-settings-search-page>
-->
<!--
<cr-settings-search-engines-page prefs="{{prefs}}" <cr-settings-search-engines-page prefs="{{prefs}}"
route="search-engines"> route="search-engines">
</cr-settings-search-engines-page> </cr-settings-search-engines-page>
</core-animated-pages> -->
</iron-pages>
</more-route-selector> </more-route-selector>
</div> </div>
</template> </template>
......
...@@ -8,47 +8,51 @@ ...@@ -8,47 +8,51 @@
* *
* Example: * Example:
* *
* <cr-settings-main pages="{{pages}}" selectedPageId="{{selectedId}}"> * <cr-settings-main pages="[[pages]]" selected-page-id="{{selectedId}}">
* </cr-settings-main> * </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 * @group Chrome Settings Elements
* @element cr-settings-main * @element cr-settings-main
*/ */
Polymer('cr-settings-main', { Polymer({
publish: { is: 'cr-settings-main',
properties: {
/** /**
* Preferences state. * Preferences state.
* *
* @attribute prefs * @type {?CrSettingsPrefsElement}
* @type CrSettingsPrefsElement
* @default null
*/ */
prefs: null, prefs: {
type: Object,
notify: true,
},
/** /**
* Pages that may be shown. * Pages that may be shown.
* * @type {?Array<!HTMLElement>}
* @attribute pages
* @type Array<!Object>
* @default null
*/ */
pages: null, pages: Array,
/** /**
* ID of the currently selected page. * Currently selected page.
* * @type {?HTMLElement}
* @attribute selectedPageId
* @type string
* default ''
*/ */
selectedPageId: '', selectedPage: {
}, type: Object,
notify: true,
},
/** @override */ /**
created: function() { * ID of the currently selected page.
this.pages = []; */
selectedPageId: {
type: String,
notify: true,
observe: 'selectedPageIdChanged_',
},
}, },
/** @override */ /** @override */
...@@ -62,14 +66,15 @@ Polymer('cr-settings-main', { ...@@ -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; 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: * for two reasons:
* 1) We need to exclude subpages * 1) We need to exclude subpages
* 2) There is a bug with data binding or our useage of it here causing * 2) There is a bug with data binding or our useage of it here causing
...@@ -78,7 +83,7 @@ Polymer('cr-settings-main', { ...@@ -78,7 +83,7 @@ Polymer('cr-settings-main', {
* fixing this and using filters once we switch to Polymer 0.8. * fixing this and using filters once we switch to Polymer 0.8.
* @private * @private
*/ */
onCoreSelect_: function(event) { onIronSelect_: function(event) {
if (event.target != this.$.pageContainer || !event.detail.isSelected || if (event.target != this.$.pageContainer || !event.detail.isSelected ||
event.detail.item.subpage) { event.detail.item.subpage) {
return; return;
...@@ -89,7 +94,6 @@ Polymer('cr-settings-main', { ...@@ -89,7 +94,6 @@ Polymer('cr-settings-main', {
/** /**
* If no page is selected, selects the first page. This happens on load and * If no page is selected, selects the first page. This happens on load and
* when a selected page is removed. * when a selected page is removed.
*
* @private * @private
*/ */
ensureSelection_: function() { ensureSelection_: function() {
...@@ -100,8 +104,7 @@ Polymer('cr-settings-main', { ...@@ -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 * @private
*/ */
pageContainerUpdated_: function() { pageContainerUpdated_: function() {
......
...@@ -41,8 +41,8 @@ ...@@ -41,8 +41,8 @@
<structure name="IDR_SETTINGS_CR_SETTINGS_DRAWER_JS" <structure name="IDR_SETTINGS_CR_SETTINGS_DRAWER_JS"
file="settings_drawer/settings_drawer.js" file="settings_drawer/settings_drawer.js"
type="chrome_html" /> type="chrome_html" />
<structure name="IDR_SETTINGS_CR_SETTINGS_MAIN_STYLE_HTML" <structure name="IDR_SETTINGS_CR_SETTINGS_MAIN_CSS"
file="settings_main/settings_main_style.html" file="settings_main/settings_main.css"
type="chrome_html" /> type="chrome_html" />
<structure name="IDR_SETTINGS_CR_SETTINGS_MAIN_HTML" <structure name="IDR_SETTINGS_CR_SETTINGS_MAIN_HTML"
file="settings_main/settings_main.html" file="settings_main/settings_main.html"
......
...@@ -532,6 +532,42 @@ ...@@ -532,6 +532,42 @@
<structure name="IDR_POLYMER_08_IRON_META_IRON_META_EXTRACTED_JS" <structure name="IDR_POLYMER_08_IRON_META_IRON_META_EXTRACTED_JS"
file="../../../third_party/polymer/v0_8/components-chromium/iron-meta/iron-meta-extracted.js" file="../../../third_party/polymer/v0_8/components-chromium/iron-meta/iron-meta-extracted.js"
type="chrome_html" /> type="chrome_html" />
<structure name="IDR_POLYMER_08_IRON_PAGES_IRON_PAGES_HTML"
file="../../../third_party/polymer/v0_8/components-chromium/iron-pages/iron-pages.html"
type="chrome_html" />
<structure name="IDR_POLYMER_08_IRON_PAGES_IRON_PAGES_EXTRACTED_JS"
file="../../../third_party/polymer/v0_8/components-chromium/iron-pages/iron-pages-extracted.js"
type="chrome_html" />
<structure name="IDR_POLYMER_08_IRON_RESIZABLE_BEHAVIOR_IRON_RESIZABLE_BEHAVIOR_HTML"
file="../../../third_party/polymer/v0_8/components-chromium/iron-resizable-behavior/iron-resizable-behavior.html"
type="chrome_html" />
<structure name="IDR_POLYMER_08_IRON_RESIZABLE_BEHAVIOR_IRON_RESIZABLE_BEHAVIOR_EXTRACTED_JS"
file="../../../third_party/polymer/v0_8/components-chromium/iron-resizable-behavior/iron-resizable-behavior-extracted.js"
type="chrome_html" />
<structure name="IDR_POLYMER_08_IRON_SELECTOR_IRON_MULTI_SELECTABLE_HTML"
file="../../../third_party/polymer/v0_8/components-chromium/iron-selector/iron-multi-selectable.html"
type="chrome_html" />
<structure name="IDR_POLYMER_08_IRON_SELECTOR_IRON_MULTI_SELECTABLE_EXTRACTED_JS"
file="../../../third_party/polymer/v0_8/components-chromium/iron-selector/iron-multi-selectable-extracted.js"
type="chrome_html" />
<structure name="IDR_POLYMER_08_IRON_SELECTOR_IRON_SELECTABLE_HTML"
file="../../../third_party/polymer/v0_8/components-chromium/iron-selector/iron-selectable.html"
type="chrome_html" />
<structure name="IDR_POLYMER_08_IRON_SELECTOR_IRON_SELECTABLE_EXTRACTED_JS"
file="../../../third_party/polymer/v0_8/components-chromium/iron-selector/iron-selectable-extracted.js"
type="chrome_html" />
<structure name="IDR_POLYMER_08_IRON_SELECTOR_IRON_SELECTION_HTML"
file="../../../third_party/polymer/v0_8/components-chromium/iron-selector/iron-selection.html"
type="chrome_html" />
<structure name="IDR_POLYMER_08_IRON_SELECTOR_IRON_SELECTION_EXTRACTED_JS"
file="../../../third_party/polymer/v0_8/components-chromium/iron-selector/iron-selection-extracted.js"
type="chrome_html" />
<structure name="IDR_POLYMER_08_IRON_SELECTOR_IRON_SELECTOR_HTML"
file="../../../third_party/polymer/v0_8/components-chromium/iron-selector/iron-selector.html"
type="chrome_html" />
<structure name="IDR_POLYMER_08_IRON_SELECTOR_IRON_SELECTOR_EXTRACTED_JS"
file="../../../third_party/polymer/v0_8/components-chromium/iron-selector/iron-selector-extracted.js"
type="chrome_html" />
<structure name="IDR_POLYMER_08_PAPER_BEHAVIORS_PAPER_BUTTON_BEHAVIOR_HTML" <structure name="IDR_POLYMER_08_PAPER_BEHAVIORS_PAPER_BUTTON_BEHAVIOR_HTML"
file="../../../third_party/polymer/v0_8/components-chromium/paper-behaviors/paper-button-behavior.html" file="../../../third_party/polymer/v0_8/components-chromium/paper-behaviors/paper-button-behavior.html"
...@@ -637,44 +673,59 @@ ...@@ -637,44 +673,59 @@
<structure name="IDR_POLYMER_08_MORE_ROUTING_DRIVER_HASH_EXTRACTED_JS" <structure name="IDR_POLYMER_08_MORE_ROUTING_DRIVER_HASH_EXTRACTED_JS"
file="../../../third_party/polymer/v0_8/components-chromium/more-routing/driver/hash-extracted.js" file="../../../third_party/polymer/v0_8/components-chromium/more-routing/driver/hash-extracted.js"
type="chrome_html" /> type="chrome_html" />
<structure name="IDR_POLYMER_08_MORE_ROUTING_MORE_ROUTE_HTML" <structure name="IDR_POLYMER_08_MORE_ROUTING_DRIVER_MOCK_EXTRACTED_JS"
file="../../../third_party/polymer/v0_8/components-chromium/more-routing/more-route.html" file="../../../third_party/polymer/v0_8/components-chromium/more-routing/driver/mock-extracted.js"
type="chrome_html" />
<structure name="IDR_POLYMER_08_MORE_ROUTING_DRIVER_MOCK_HTML"
file="../../../third_party/polymer/v0_8/components-chromium/more-routing/driver/mock.html"
type="chrome_html" />
<structure name="IDR_POLYMER_08_MORE_ROUTING_DRIVER_PATH_EXTRACTED_JS"
file="../../../third_party/polymer/v0_8/components-chromium/more-routing/driver/path-extracted.js"
type="chrome_html" />
<structure name="IDR_POLYMER_08_MORE_ROUTING_DRIVER_PATH_HTML"
file="../../../third_party/polymer/v0_8/components-chromium/more-routing/driver/path.html"
type="chrome_html" /> type="chrome_html" />
<structure name="IDR_POLYMER_08_MORE_ROUTING_MORE_ROUTE_EXTRACTED_JS" <structure name="IDR_POLYMER_08_MORE_ROUTING_MORE_ROUTE_EXTRACTED_JS"
file="../../../third_party/polymer/v0_8/components-chromium/more-routing/more-route-extracted.js" file="../../../third_party/polymer/v0_8/components-chromium/more-routing/more-route-extracted.js"
type="chrome_html" /> type="chrome_html" />
<structure name="IDR_POLYMER_08_MORE_ROUTING_MORE_ROUTE_CONTEXT_AWARE_HTML" <structure name="IDR_POLYMER_08_MORE_ROUTING_MORE_ROUTE_HTML"
file="../../../third_party/polymer/v0_8/components-chromium/more-routing/more-route-context-aware.html" file="../../../third_party/polymer/v0_8/components-chromium/more-routing/more-route.html"
type="chrome_html" /> type="chrome_html" />
<structure name="IDR_POLYMER_08_MORE_ROUTING_MORE_ROUTE_CONTEXT_AWARE_EXTRACTED_JS" <structure name="IDR_POLYMER_08_MORE_ROUTING_MORE_ROUTE_CONTEXT_AWARE_EXTRACTED_JS"
file="../../../third_party/polymer/v0_8/components-chromium/more-routing/more-route-context-aware-extracted.js" file="../../../third_party/polymer/v0_8/components-chromium/more-routing/more-route-context-aware-extracted.js"
type="chrome_html" /> type="chrome_html" />
<structure name="IDR_POLYMER_08_MORE_ROUTING_MORE_ROUTE_SELECTION_HTML" <structure name="IDR_POLYMER_08_MORE_ROUTING_MORE_ROUTE_CONTEXT_AWARE_HTML"
file="../../../third_party/polymer/v0_8/components-chromium/more-routing/more-route-selection.html" file="../../../third_party/polymer/v0_8/components-chromium/more-routing/more-route-context-aware.html"
type="chrome_html" /> type="chrome_html" />
<structure name="IDR_POLYMER_08_MORE_ROUTING_MORE_ROUTE_SELECTION_EXTRACTED_JS" <structure name="IDR_POLYMER_08_MORE_ROUTING_MORE_ROUTE_SELECTION_EXTRACTED_JS"
file="../../../third_party/polymer/v0_8/components-chromium/more-routing/more-route-selection-extracted.js" file="../../../third_party/polymer/v0_8/components-chromium/more-routing/more-route-selection-extracted.js"
type="chrome_html" /> type="chrome_html" />
<structure name="IDR_POLYMER_08_MORE_ROUTING_MORE_ROUTE_SELECTOR_HTML" <structure name="IDR_POLYMER_08_MORE_ROUTING_MORE_ROUTE_SELECTION_HTML"
file="../../../third_party/polymer/v0_8/components-chromium/more-routing/more-route-selector.html" file="../../../third_party/polymer/v0_8/components-chromium/more-routing/more-route-selection.html"
type="chrome_html" /> type="chrome_html" />
<structure name="IDR_POLYMER_08_MORE_ROUTING_MORE_ROUTE_SELECTOR_EXTRACTED_JS" <structure name="IDR_POLYMER_08_MORE_ROUTING_MORE_ROUTE_SELECTOR_EXTRACTED_JS"
file="../../../third_party/polymer/v0_8/components-chromium/more-routing/more-route-selector-extracted.js" file="../../../third_party/polymer/v0_8/components-chromium/more-routing/more-route-selector-extracted.js"
type="chrome_html" /> type="chrome_html" />
<structure name="IDR_POLYMER_08_MORE_ROUTING_MORE_ROUTING_CONFIG_HTML" <structure name="IDR_POLYMER_08_MORE_ROUTING_MORE_ROUTE_SELECTOR_HTML"
file="../../../third_party/polymer/v0_8/components-chromium/more-routing/more-routing-config.html" file="../../../third_party/polymer/v0_8/components-chromium/more-routing/more-route-selector.html"
type="chrome_html" /> type="chrome_html" />
<structure name="IDR_POLYMER_08_MORE_ROUTING_MORE_ROUTING_CONFIG_EXTRACTED_JS" <structure name="IDR_POLYMER_08_MORE_ROUTING_MORE_ROUTING_CONFIG_EXTRACTED_JS"
file="../../../third_party/polymer/v0_8/components-chromium/more-routing/more-routing-config-extracted.js" file="../../../third_party/polymer/v0_8/components-chromium/more-routing/more-routing-config-extracted.js"
type="chrome_html" /> type="chrome_html" />
<structure name="IDR_POLYMER_08_MORE_ROUTING_MORE_ROUTING_CONFIG_HTML"
file="../../../third_party/polymer/v0_8/components-chromium/more-routing/more-routing-config.html"
type="chrome_html" />
<structure name="IDR_POLYMER_08_MORE_ROUTING_MORE_ROUTING_HTML" <structure name="IDR_POLYMER_08_MORE_ROUTING_MORE_ROUTING_HTML"
file="../../../third_party/polymer/v0_8/components-chromium/more-routing/more-routing.html" file="../../../third_party/polymer/v0_8/components-chromium/more-routing/more-routing.html"
type="chrome_html" /> type="chrome_html" />
<structure name="IDR_POLYMER_08_MORE_ROUTING_ROUTE_EXTRACTED_JS"
file="../../../third_party/polymer/v0_8/components-chromium/more-routing/route-extracted.js"
type="chrome_html" />
<structure name="IDR_POLYMER_08_MORE_ROUTING_ROUTE_HTML" <structure name="IDR_POLYMER_08_MORE_ROUTING_ROUTE_HTML"
file="../../../third_party/polymer/v0_8/components-chromium/more-routing/route.html" file="../../../third_party/polymer/v0_8/components-chromium/more-routing/route.html"
type="chrome_html" /> type="chrome_html" />
<structure name="IDR_POLYMER_08_MORE_ROUTING_ROUTE_EXTRACTED_JS" <structure name="IDR_POLYMER_08_MORE_ROUTING_ROUTING_EXTRACTED_JS"
file="../../../third_party/polymer/v0_8/components-chromium/more-routing/route-extracted.js" file="../../../third_party/polymer/v0_8/components-chromium/more-routing/routing-extracted.js"
type="chrome_html" /> type="chrome_html" />
<structure name="IDR_POLYMER_08_MORE_ROUTING_ROUTING_HTML" <structure name="IDR_POLYMER_08_MORE_ROUTING_ROUTING_HTML"
file="../../../third_party/polymer/v0_8/components-chromium/more-routing/routing.html" file="../../../third_party/polymer/v0_8/components-chromium/more-routing/routing.html"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment