| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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) && | 119 } else if (settings.Route.ADVANCED.contains(currentRoute) && |
| 120 // Need to exclude routes that correspond to 'non-sectioned' children of | 120 // Need to exclude routes that correspond to 'non-sectioned' children of |
| 121 // ADVANCED, otherwise tryTransitionToSection_ will recurse endlessly. | 121 // ADVANCED, otherwise tryTransitionToSection_ will recurse endlessly. |
| 122 !currentRoute.isNavigableDialog) { | 122 !currentRoute.isNavigableDialog) { |
| 123 assert(currentRoute.section); |
| 123 promise = this.$$('#advancedPageTemplate').get(); | 124 promise = this.$$('#advancedPageTemplate').get(); |
| 124 } | 125 } |
| 125 | 126 |
| 126 // When this animation ends, another may be necessary. Call this function | 127 // When this animation ends, another may be necessary. Call this function |
| 127 // again after the promise resolves. | 128 // again after the promise resolves. |
| 128 if (promise) | 129 if (promise) |
| 129 promise.then(this.tryTransitionToSection_.bind(this, scrollToSection)); | 130 promise.then(this.tryTransitionToSection_.bind(this, scrollToSection)); |
| 130 }, | 131 }, |
| 131 | 132 |
| 132 /** | 133 /** |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 return /** @type {?SettingsSectionElement} */( | 310 return /** @type {?SettingsSectionElement} */( |
| 310 this.$$('settings-section[section="' + section + '"]')); | 311 this.$$('settings-section[section="' + section + '"]')); |
| 311 }, | 312 }, |
| 312 }; | 313 }; |
| 313 | 314 |
| 314 /** @polymerBehavior */ | 315 /** @polymerBehavior */ |
| 315 var MainPageBehavior = [ | 316 var MainPageBehavior = [ |
| 316 settings.RouteObserverBehavior, | 317 settings.RouteObserverBehavior, |
| 317 MainPageBehaviorImpl, | 318 MainPageBehaviorImpl, |
| 318 ]; | 319 ]; |
| OLD | NEW |