Chromium Code Reviews| Index: chrome/browser/resources/settings/settings_page/settings_section.js |
| diff --git a/chrome/browser/resources/settings/settings_page/settings_section.js b/chrome/browser/resources/settings/settings_page/settings_section.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..96883a3fd31caa39a78c12788103064db9ffe4e5 |
| --- /dev/null |
| +++ b/chrome/browser/resources/settings/settings_page/settings_section.js |
| @@ -0,0 +1,36 @@ |
| +// 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. |
| + |
| +/** |
| + * @fileoverview |
| + * 'cr-settings-section' shows a paper material themed section with a header |
| + * which shows its page title and icon. Note, the page title and icon are not |
| + * bound properties, but are instead directly retrieved from the content |
| + * element. |
| + * |
| + * Example: |
| + * |
| + * <cr-settings-section> |
| + * <!-- Insert your section controls here --> |
| + * </cr-settings-section> |
| + * |
| + * @group Chrome Settings Elements |
| + * @element cr-settings-section |
| + */ |
| +Polymer({ |
| + is: 'cr-settings-section', |
| + |
| + ready: function() { |
| + // We use this trickery to retrieve the content page's title and icon, as |
| + // Polymer does not support directly binding content element properties. |
| + var contentElement = this.getContentChildren()[0]; |
| + if (contentElement != undefined && |
| + contentElement.properties != undefined) { |
| + // Page title value is defined as a function. |
| + this.pageTitle = contentElement.properties.pageTitle.value(); |
| + // Icon value is defined as a property. |
| + this.icon = contentElement.properties.icon.value; |
|
Dan Beam
2015/07/22 23:12:17
why are we setting titles in JS vs just with i18n-
michaelpg
2015/07/22 23:26:55
basically we bound the header to the title of the
|
| + } |
| + } |
| +}); |