Commit 89b44859 authored by jlklein's avatar jlklein Committed by Commit bot

Convert the downloads page to Polymer 0.8

BUG=485381

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

Cr-Commit-Position: refs/heads/master@{#329554}
parent 0c4d95ca
<!doctype html>
<html>
<head>
<link href="downloads_page.html" rel="import">
<link href="../prefs/prefs.html" rel="import">
<script src="demo.js"></script>
</head>
<body unresolved>
<cr-settings-prefs></cr-settings-prefs>
<cr-settings-downloads-page></cr-settings-downloads-page>
</body>
</html>
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Wire up the prefs to the downloads page.
window.addEventListener('polymer-ready', function() {
var page = document.querySelector('cr-settings-downloads-page');
page.prefs = document.querySelector('cr-settings-prefs');
});
<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="downloadsPageStyle">
cr-input { cr-input {
width: 300px;
}
cr-input::shadow #input {
/* This ensures that the "Download location" label and the text in the input /* This ensures that the "Download location" label and the text in the input
* itself are vertically aligned. */ * itself are vertically aligned. */
margin: 0.25em 0; margin-bottom: 1em;
width: 300px;
} }
.location-label { #locationLabel {
-webkit-margin-end: 10px; -webkit-margin-end: 10px;
} }
</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-label/core-label.html"> <link rel="import" href="chrome://resources/polymer/v0_8/iron-flex-layout/classes/iron-flex-layout.html">
<link rel="import" href="chrome://resources/polymer/paper-input/paper-input.html"> <link rel="import" href="chrome://resources/polymer/v0_8/paper-input/paper-input.html">
<link rel="import" href="chrome://resources/polymer/paper-shadow/paper-shadow.html"> <link rel="import" href="chrome://resources/polymer/v0_8/paper-material/paper-material.html">
<link rel="import" href="chrome://resources/cr_elements/cr_button/cr_button.html"> <link rel="import" href="chrome://resources/cr_elements/v0_8/cr_button/cr_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_input/cr_input.html"> <link rel="import" href="chrome://resources/cr_elements/v0_8/cr_input/cr_input.html">
<link rel="import" href="chrome://md-settings/checkbox/checkbox.html"> <link rel="import" href="chrome://md-settings/checkbox/checkbox.html">
<link rel="import" href="downloads_page_style.html">
<polymer-element name="cr-settings-downloads-page"> <dom-module id="cr-settings-downloads-page">
<link rel="import" type="css" href="chrome://md-settings/settings_page/settings_page.css">
<link rel="import" type="css" href="downloads_page.css">
<template> <template>
<link rel="stylesheet" href="chrome://md-settings/settings_page/settings_page.css"> <paper-material>
<core-style ref="downloadsPageStyle"></core-style> <div class="horizontal layout center">
<paper-shadow layout vertical cross-fade> <div class="layout horizontal center">
<div horizontal layout center> <div id="locationLabel" i18n-content="downloadsLocationLabel"></div>
<core-label horizontal layout center> <cr-input id="downloadsPath" floating-label="false"
<span class="location-label" i18n-content="downloadsLocationLabel"></span> value="{{prefs.settings.download.default_directory.value}}"
<cr-input id="downloadsPath" floatingLabel="false" readonly aria-labelledby="locationLabel">
value="{{prefs.settings.download.default_directory.value}}" readonly for>
</cr-input> </cr-input>
</core-label> </div>
<cr-button id="changeDownloadsPath" on-click="{{selectDownloadLocation}}" <cr-button id="changeDownloadsPath" on-click="selectDownloadLocation_"
i18n-content="downloadsChangeLocationButton"> i18n-content="downloadsChangeLocationButton">
</cr-button> </cr-button>
</div> </div>
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
pref="{{prefs.settings.download.prompt_for_download}}" pref="{{prefs.settings.download.prompt_for_download}}"
i18n-values="label:downloadsPromptForDownloadLabel"> i18n-values="label:downloadsPromptForDownloadLabel">
</cr-settings-checkbox> </cr-settings-checkbox>
</paper-shadow> </paper-material>
</template> </template>
<script src="downloads_page.js"></script> <script src="downloads_page.js"></script>
</polymer-element> </dom-module>
...@@ -9,72 +9,73 @@ ...@@ -9,72 +9,73 @@
* *
* Example: * Example:
* *
* <core-animated-pages> * <iron-animated-pages>
* <cr-settings-downloads-page prefs="{{prefs}}"> * <cr-settings-downloads-page prefs="{{prefs}}">
* </cr-settings-downloads-page> * </cr-settings-downloads-page>
* ... other pages ... * ... other pages ...
* </core-animated-pages> * </iron-animated-pages>
* *
* @group Chrome Settings Elements * @group Chrome Settings Elements
* @element cr-settings-downloads-page * @element cr-settings-downloads-page
*/ */
Polymer('cr-settings-downloads-page', { Polymer({
publish: { is: 'cr-settings-downloads-page',
properties: {
/** /**
* Preferences state. * Preferences state.
* * @type {?CrSettingsPrefsElement}
* @attribute prefs
* @type CrSettingsPrefsElement
* @default null
*/ */
prefs: null, prefs: {
type: Object,
notify: true,
},
/** /**
* Route for the page. * Route for the page.
*
* @attribute route
* @type string
* @default ''
*/ */
route: '', route: String,
/** /**
* Whether the page is a subpage. * Whether the page is a subpage.
*
* @attribute subpage
* @type boolean
* @default false
*/ */
subpage: false, subpage: {
type: Boolean,
value: false,
readOnly: true,
},
/** /**
* ID of the page. * ID of the page.
*
* @attribute PAGE_ID
* @const string
* @default 'downloads'
*/ */
PAGE_ID: 'downloads', PAGE_ID: {
type: String,
value: 'downloads',
readOnly: true,
},
/** /**
* Title for the page header and navigation menu. * Title for the page header and navigation menu.
*
* @attribute pageTitle
* @type string
*/ */
pageTitle: loadTimeData.getString('downloadsPageTitle'), pageTitle: {
type: String,
value: function() {
return loadTimeData.getString('downloadsPageTitle');
},
},
/** /**
* Name of the 'core-icon' to show. * Name of the 'iron-icon' to show.
*
* @attribute icon
* @type string
* @default 'file-download'
*/ */
icon: 'file-download', icon: {
type: String,
value: 'file-download',
readOnly: true,
},
}, },
selectDownloadLocation: function() { /** @private */
selectDownloadLocation_: function() {
// TODO(orenb): Communicate with the C++ to actually display a folder // TODO(orenb): Communicate with the C++ to actually display a folder
// picker. // picker.
this.$.downloadsPath.value = '/Downloads'; this.$.downloadsPath.value = '/Downloads';
......
...@@ -91,8 +91,8 @@ ...@@ -91,8 +91,8 @@
<structure name="IDR_SETTINGS_DATE_TIME_PAGE_JS" <structure name="IDR_SETTINGS_DATE_TIME_PAGE_JS"
file="date_time_page/date_time_page.js" file="date_time_page/date_time_page.js"
type="chrome_html" /> type="chrome_html" />
<structure name="IDR_SETTINGS_DOWNLOADS_PAGE_STYLE_HTML" <structure name="IDR_SETTINGS_DOWNLOADS_PAGE_CSS"
file="downloads_page/downloads_page_style.html" file="downloads_page/downloads_page.css"
type="chrome_html" /> type="chrome_html" />
<structure name="IDR_SETTINGS_DOWNLOADS_PAGE_HTML" <structure name="IDR_SETTINGS_DOWNLOADS_PAGE_HTML"
file="downloads_page/downloads_page.html" file="downloads_page/downloads_page.html"
......
...@@ -529,6 +529,12 @@ ...@@ -529,6 +529,12 @@
<structure name="IDR_POLYMER_08_IRON_ICONSET_SVG_IRON_ICONSET_SVG_EXTRACTED_JS" <structure name="IDR_POLYMER_08_IRON_ICONSET_SVG_IRON_ICONSET_SVG_EXTRACTED_JS"
file="../../../third_party/polymer/v0_8/components-chromium/iron-iconset-svg/iron-iconset-svg-extracted.js" file="../../../third_party/polymer/v0_8/components-chromium/iron-iconset-svg/iron-iconset-svg-extracted.js"
type="chrome_html" /> type="chrome_html" />
<structure name="IDR_POLYMER_08_IRON_INPUT_IRON_INPUT_HTML"
file="../../../third_party/polymer/v0_8/components-chromium/iron-input/iron-input.html"
type="chrome_html" />
<structure name="IDR_POLYMER_08_IRON_INPUT_IRON_INPUT_EXTRACTED_JS"
file="../../../third_party/polymer/v0_8/components-chromium/iron-input/iron-input-extracted.js"
type="chrome_html" />
<structure name="IDR_POLYMER_08_IRON_MEDIA_QUERY_IRON_MEDIA_QUERY_HTML" <structure name="IDR_POLYMER_08_IRON_MEDIA_QUERY_IRON_MEDIA_QUERY_HTML"
file="../../../third_party/polymer/v0_8/components-chromium/iron-media-query/iron-media-query.html" file="../../../third_party/polymer/v0_8/components-chromium/iron-media-query/iron-media-query.html"
type="chrome_html" /> type="chrome_html" />
...@@ -590,6 +596,12 @@ ...@@ -590,6 +596,12 @@
<structure name="IDR_POLYMER_08_PAPER_BEHAVIORS_PAPER_BUTTON_BEHAVIOR_EXTRACTED_JS" <structure name="IDR_POLYMER_08_PAPER_BEHAVIORS_PAPER_BUTTON_BEHAVIOR_EXTRACTED_JS"
file="../../../third_party/polymer/v0_8/components-chromium/paper-behaviors/paper-button-behavior-extracted.js" file="../../../third_party/polymer/v0_8/components-chromium/paper-behaviors/paper-button-behavior-extracted.js"
type="chrome_html" /> type="chrome_html" />
<structure name="IDR_POLYMER_08_PAPER_BEHAVIORS_PAPER_RADIO_BUTTON_BEHAVIOR_HTML"
file="../../../third_party/polymer/v0_8/components-chromium/paper-behaviors/paper-radio-button-behavior.html"
type="chrome_html" />
<structure name="IDR_POLYMER_08_PAPER_BEHAVIORS_PAPER_RADIO_BUTTON_BEHAVIOR_EXTRACTED_JS"
file="../../../third_party/polymer/v0_8/components-chromium/paper-behaviors/paper-radio-button-behavior-extracted.js"
type="chrome_html" />
<structure name="IDR_POLYMER_08_PAPER_BUTTON_PAPER_BUTTON_EXTRACTED_JS" <structure name="IDR_POLYMER_08_PAPER_BUTTON_PAPER_BUTTON_EXTRACTED_JS"
file="../../../third_party/polymer/v0_8/components-chromium/paper-button/paper-button-extracted.js" file="../../../third_party/polymer/v0_8/components-chromium/paper-button/paper-button-extracted.js"
type="chrome_html" /> type="chrome_html" />
...@@ -629,6 +641,12 @@ ...@@ -629,6 +641,12 @@
<structure name="IDR_POLYMER_08_PAPER_INPUT_PAPER_INPUT_HTML" <structure name="IDR_POLYMER_08_PAPER_INPUT_PAPER_INPUT_HTML"
file="../../../third_party/polymer/v0_8/components-chromium/paper-input/paper-input.html" file="../../../third_party/polymer/v0_8/components-chromium/paper-input/paper-input.html"
type="chrome_html" /> type="chrome_html" />
<structure name="IDR_POLYMER_08_PAPER_INPUT_PAPER_INPUT_BEHAVIOR_EXTRACTED_JS"
file="../../../third_party/polymer/v0_8/components-chromium/paper-input/paper-input-behavior-extracted.js"
type="chrome_html" />
<structure name="IDR_POLYMER_08_PAPER_INPUT_PAPER_INPUT_BEHAVIOR_HTML"
file="../../../third_party/polymer/v0_8/components-chromium/paper-input/paper-input-behavior.html"
type="chrome_html" />
<structure name="IDR_POLYMER_08_PAPER_INPUT_PAPER_INPUT_CHAR_COUNTER_EXTRACTED_JS" <structure name="IDR_POLYMER_08_PAPER_INPUT_PAPER_INPUT_CHAR_COUNTER_EXTRACTED_JS"
file="../../../third_party/polymer/v0_8/components-chromium/paper-input/paper-input-char-counter-extracted.js" file="../../../third_party/polymer/v0_8/components-chromium/paper-input/paper-input-char-counter-extracted.js"
type="chrome_html" /> type="chrome_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