OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview | 6 * @fileoverview |
7 * 'settings-animated-pages' is a container for a page and animated subpages. | 7 * 'settings-animated-pages' is a container for a page and animated subpages. |
8 * It provides a set of common behaviors and animations. | 8 * It provides a set of common behaviors and animations. |
9 * | 9 * |
10 * Example: | 10 * Example: |
11 * | 11 * |
12 * <settings-animated-pages current-route="{{currentRoute}}" | 12 * <settings-animated-pages current-route="{{currentRoute}}" |
13 route-root="advanced/privacy" redirect-root-route-to="advanced"> | 13 * section="privacy"> |
14 * <!-- Insert your section controls here --> | 14 * <!-- Insert your section controls here --> |
15 * </settings-animated-pages> | 15 * </settings-animated-pages> |
16 * | 16 * |
17 * @group Chrome Settings Elements | 17 * @group Chrome Settings Elements |
18 * @element settings-animated-pages | 18 * @element settings-animated-pages |
19 */ | 19 */ |
20 Polymer({ | 20 Polymer({ |
21 is: 'settings-animated-pages', | 21 is: 'settings-animated-pages', |
22 | 22 |
23 properties: { | 23 properties: { |
24 /** | 24 /** |
25 * Contains the current route. | 25 * Contains the current route. |
26 */ | 26 */ |
27 currentRoute: { | 27 currentRoute: { |
28 type: Object, | 28 type: Object, |
29 notify: true, | 29 notify: true, |
30 observer: 'currentRouteChanged_', | 30 observer: 'currentRouteChanged_', |
31 }, | 31 }, |
32 | 32 |
33 /** | 33 /** |
34 * Routes with this section activate this element. For instance, if this | 34 * Routes with this section activate this element. For instance, if this |
35 * property is 'search', and currentRoute.section is also set to 'search', | 35 * property is 'search', and currentRoute.section is also set to 'search', |
36 * this element will display the subpage in currentRoute.subpage. | 36 * this element will display the subpage in currentRoute.subpage. |
| 37 * |
| 38 * The section name must match the name specified in settings_router.js. |
37 */ | 39 */ |
38 section: { | 40 section: { |
39 type: String, | 41 type: String, |
40 }, | 42 }, |
41 }, | 43 }, |
42 | 44 |
43 /** @override */ | 45 /** @override */ |
44 created: function() { | 46 created: function() { |
45 this.addEventListener('subpage-back', function() { | 47 this.addEventListener('subpage-back', function() { |
46 assert(this.currentRoute.section == this.section); | 48 assert(this.currentRoute.section == this.section); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 * Buttons in this pageset should use this method to transition to subpages. | 85 * Buttons in this pageset should use this method to transition to subpages. |
84 */ | 86 */ |
85 setSubpageChain: function(subpage) { | 87 setSubpageChain: function(subpage) { |
86 this.currentRoute = { | 88 this.currentRoute = { |
87 page: this.currentRoute.page, | 89 page: this.currentRoute.page, |
88 section: subpage.length > 0 ? this.section : '', | 90 section: subpage.length > 0 ? this.section : '', |
89 subpage: subpage, | 91 subpage: subpage, |
90 }; | 92 }; |
91 }, | 93 }, |
92 }); | 94 }); |
OLD | NEW |