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

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

Issue 2184893002: Settings Router Refactor: Remove route.page legacy property. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@0217-settings-refactor-settings-menu
Patch Set: fix contains issue. Created 4 years, 4 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 // Fast out, slow in. 5 // Fast out, slow in.
6 var EASING_FUNCTION = 'cubic-bezier(0.4, 0, 0.2, 1)'; 6 var EASING_FUNCTION = 'cubic-bezier(0.4, 0, 0.2, 1)';
7 var EXPAND_DURATION = 350; 7 var EXPAND_DURATION = 350;
8 8
9 /** 9 /**
10 * Calls |readyTest| repeatedly until it returns true, then calls 10 * Calls |readyTest| repeatedly until it returns true, then calls
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 if (section) 400 if (section)
401 this.expandSection(section); 401 this.expandSection(section);
402 } 402 }
403 } else { 403 } else {
404 if (oldRouteIsSubpage) { 404 if (oldRouteIsSubpage) {
405 var section = this.getSection_(oldRoute.section); 405 var section = this.getSection_(oldRoute.section);
406 if (section) 406 if (section)
407 this.collapseSection(section); 407 this.collapseSection(section);
408 } 408 }
409 409
410 if (newRoute && newRoute.section && 410 // Scrolls to the section if this main page contains the route's section.
411 this.$$('[data-page=' + newRoute.page + ']')) { 411 if (newRoute && newRoute.section && this.getSection_(newRoute.section))
412 this.scrollToSection_(); 412 this.scrollToSection_();
413 }
414 } 413 }
415 }, 414 },
416 415
417 /** 416 /**
418 * Helper function to get a section from the local DOM. 417 * Helper function to get a section from the local DOM.
419 * @param {string} section Section name of the element to get. 418 * @param {string} section Section name of the element to get.
420 * @return {?SettingsSectionElement} 419 * @return {?SettingsSectionElement}
421 * @private 420 * @private
422 */ 421 */
423 getSection_: function(section) { 422 getSection_: function(section) {
424 return /** @type {?SettingsSectionElement} */( 423 return /** @type {?SettingsSectionElement} */(
425 this.$$('[section=' + section + ']')); 424 this.$$('[section=' + section + ']'));
426 }, 425 },
427 }; 426 };
428 427
429 428
430 /** @polymerBehavior */ 429 /** @polymerBehavior */
431 var RoutableBehavior = [ 430 var RoutableBehavior = [
432 MainPageBehavior, 431 MainPageBehavior,
433 RoutableBehaviorImpl 432 RoutableBehaviorImpl
434 ]; 433 ];
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698