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 // Need to exclude routes that correspond to 'non-sectioned' children of | |
121 // ADVANCED, otherwise tryTransitionToSection_ will recurse endlessly. | |
122 currentRoute != settings.Route.CLEAR_BROWSER_DATA && | |
123 currentRoute != settings.Route.TRIGGERED_RESET_DIALOG && | |
124 currentRoute != settings.Route.RESET_DIALOG) { | |
Dan Beam
2017/03/21 00:29:26
can you do this without calling out specific route
dpapad
2017/03/21 00:54:51
Done.
Dan Beam
2017/03/21 01:54:16
is it OK that children of BASIC are included in th
dpapad
2017/03/21 05:36:36
Yes should be fine, because the 1st part of the co
| |
125 promise = this.$$('#advancedPageTemplate').get(); | |
119 } | 126 } |
120 | 127 |
121 // When this animation ends, another may be necessary. Call this function | 128 // When this animation ends, another may be necessary. Call this function |
122 // again after the promise resolves. | 129 // again after the promise resolves. |
123 if (promise) | 130 if (promise) |
124 promise.then(this.tryTransitionToSection_.bind(this, scrollToSection)); | 131 promise.then(this.tryTransitionToSection_.bind(this, scrollToSection)); |
125 }, | 132 }, |
126 | 133 |
127 /** | 134 /** |
128 * If the current animation is inconsistent with the current route, stops the | 135 * 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} */( | 311 return /** @type {?SettingsSectionElement} */( |
305 this.$$('settings-section[section="' + section + '"]')); | 312 this.$$('settings-section[section="' + section + '"]')); |
306 }, | 313 }, |
307 }; | 314 }; |
308 | 315 |
309 /** @polymerBehavior */ | 316 /** @polymerBehavior */ |
310 var MainPageBehavior = [ | 317 var MainPageBehavior = [ |
311 settings.RouteObserverBehavior, | 318 settings.RouteObserverBehavior, |
312 MainPageBehaviorImpl, | 319 MainPageBehaviorImpl, |
313 ]; | 320 ]; |
OLD | NEW |