| 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 } else { | 137 } else { |
| 138 // Scroll to top while sliding to another subpage. | 138 // Scroll to top while sliding to another subpage. |
| 139 this.scroller.scrollTop = 0; | 139 this.scroller.scrollTop = 0; |
| 140 } | 140 } |
| 141 } else if (currentSection) { | 141 } else if (currentSection) { |
| 142 // Expand the section into a subpage or scroll to it on the main page. | 142 // Expand the section into a subpage or scroll to it on the main page. |
| 143 if (currentRoute.isSubpage()) | 143 if (currentRoute.isSubpage()) |
| 144 promise = this.expandSection_(currentSection); | 144 promise = this.expandSection_(currentSection); |
| 145 else if (scrollToSection) | 145 else if (scrollToSection) |
| 146 currentSection.scrollIntoView(); | 146 currentSection.scrollIntoView(); |
| 147 } else if (settings.Route.ADVANCED.contains(currentRoute) && | 147 } else if ( |
| 148 this.tagName == 'SETTINGS-BASIC-PAGE' && |
| 149 settings.Route.ADVANCED.contains(currentRoute) && |
| 148 // Need to exclude routes that correspond to 'non-sectioned' children of | 150 // Need to exclude routes that correspond to 'non-sectioned' children of |
| 149 // ADVANCED, otherwise tryTransitionToSection_ will recurse endlessly. | 151 // ADVANCED, otherwise tryTransitionToSection_ will recurse endlessly. |
| 150 !currentRoute.isNavigableDialog) { | 152 !currentRoute.isNavigableDialog) { |
| 151 assert(currentRoute.section); | 153 assert(currentRoute.section); |
| 152 promise = this.$$('#advancedPageTemplate').get(); | 154 promise = this.$$('#advancedPageTemplate').get(); |
| 153 } | 155 } |
| 154 | 156 |
| 155 // When this animation ends, another may be necessary. Call this function | 157 // When this animation ends, another may be necessary. Call this function |
| 156 // again after the promise resolves. | 158 // again after the promise resolves. |
| 157 if (promise) | 159 if (promise) |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 return /** @type {?SettingsSectionElement} */( | 340 return /** @type {?SettingsSectionElement} */( |
| 339 this.$$('settings-section[section="' + section + '"]')); | 341 this.$$('settings-section[section="' + section + '"]')); |
| 340 }, | 342 }, |
| 341 }; | 343 }; |
| 342 | 344 |
| 343 /** @polymerBehavior */ | 345 /** @polymerBehavior */ |
| 344 var MainPageBehavior = [ | 346 var MainPageBehavior = [ |
| 345 settings.RouteObserverBehavior, | 347 settings.RouteObserverBehavior, |
| 346 MainPageBehaviorImpl, | 348 MainPageBehaviorImpl, |
| 347 ]; | 349 ]; |
| OLD | NEW |