OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 * Responds to route changes by expanding, collapsing, or scrolling to sections | 6 * Responds to route changes by expanding, collapsing, or scrolling to sections |
7 * on the page. Expanded sections take up the full height of the container. At | 7 * on the page. Expanded sections take up the full height of the container. At |
8 * most one section should be expanded at any given time. | 8 * most one section should be expanded at any given time. |
9 * @polymerBehavior MainPageBehavior | 9 * @polymerBehavior MainPageBehavior |
10 */ | 10 */ |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 } else { | 109 } else { |
110 // Scroll to top while sliding to another subpage. | 110 // Scroll to top while sliding to another subpage. |
111 this.scroller.scrollTop = 0; | 111 this.scroller.scrollTop = 0; |
112 } | 112 } |
113 } else if (currentSection) { | 113 } else if (currentSection) { |
114 // Expand the section into a subpage or scroll to it on the main page. | 114 // Expand the section into a subpage or scroll to it on the main page. |
115 if (currentRoute.isSubpage()) | 115 if (currentRoute.isSubpage()) |
116 promise = this.expandSection_(currentSection); | 116 promise = this.expandSection_(currentSection); |
117 else if (scrollToSection) | 117 else if (scrollToSection) |
118 currentSection.scrollIntoView(); | 118 currentSection.scrollIntoView(); |
| 119 } else if (settings.Route.ADVANCED.contains(currentRoute)) { |
| 120 promise = this.$$('#advancedPageTemplate').get(); |
119 } | 121 } |
120 | 122 |
121 // When this animation ends, another may be necessary. Call this function | 123 // When this animation ends, another may be necessary. Call this function |
122 // again after the promise resolves. | 124 // again after the promise resolves. |
123 if (promise) | 125 if (promise) |
124 promise.then(this.tryTransitionToSection_.bind(this, scrollToSection)); | 126 promise.then(this.tryTransitionToSection_.bind(this, scrollToSection)); |
125 }, | 127 }, |
126 | 128 |
127 /** | 129 /** |
128 * If the current animation is inconsistent with the current route, stops the | 130 * If the current animation is inconsistent with the current route, stops the |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 return /** @type {?SettingsSectionElement} */( | 306 return /** @type {?SettingsSectionElement} */( |
305 this.$$('settings-section[section="' + section + '"]')); | 307 this.$$('settings-section[section="' + section + '"]')); |
306 }, | 308 }, |
307 }; | 309 }; |
308 | 310 |
309 /** @polymerBehavior */ | 311 /** @polymerBehavior */ |
310 var MainPageBehavior = [ | 312 var MainPageBehavior = [ |
311 settings.RouteObserverBehavior, | 313 settings.RouteObserverBehavior, |
312 MainPageBehaviorImpl, | 314 MainPageBehaviorImpl, |
313 ]; | 315 ]; |
OLD | NEW |