Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: chrome/browser/resources/settings/settings_page/main_page_behavior.js

Issue 2754563002: MD Settings: Lazy load the contents of the "advanced" settings. (Closed)
Patch Set: Address comments. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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.isNavigableDialog) {
123 promise = this.$$('#advancedPageTemplate').get();
119 } 124 }
120 125
121 // When this animation ends, another may be necessary. Call this function 126 // When this animation ends, another may be necessary. Call this function
122 // again after the promise resolves. 127 // again after the promise resolves.
123 if (promise) 128 if (promise)
124 promise.then(this.tryTransitionToSection_.bind(this, scrollToSection)); 129 promise.then(this.tryTransitionToSection_.bind(this, scrollToSection));
125 }, 130 },
126 131
127 /** 132 /**
128 * If the current animation is inconsistent with the current route, stops the 133 * If the current animation is inconsistent with the current route, stops the
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 return /** @type {?SettingsSectionElement} */( 309 return /** @type {?SettingsSectionElement} */(
305 this.$$('settings-section[section="' + section + '"]')); 310 this.$$('settings-section[section="' + section + '"]'));
306 }, 311 },
307 }; 312 };
308 313
309 /** @polymerBehavior */ 314 /** @polymerBehavior */
310 var MainPageBehavior = [ 315 var MainPageBehavior = [
311 settings.RouteObserverBehavior, 316 settings.RouteObserverBehavior,
312 MainPageBehaviorImpl, 317 MainPageBehaviorImpl,
313 ]; 318 ];
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698