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

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

Issue 2224163002: Settings Router Refactor: Replace route.subpage usage with route.path (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix 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 /** 5 /**
6 * Calls |readyTest| repeatedly until it returns true, then calls 6 * Calls |readyTest| repeatedly until it returns true, then calls
7 * |readyCallback|. 7 * |readyCallback|.
8 * @param {function():boolean} readyTest 8 * @param {function():boolean} readyTest
9 * @param {!Function} readyCallback 9 * @param {!Function} readyCallback
10 */ 10 */
(...skipping 21 matching lines...) Expand all
32 /** @override */ 32 /** @override */
33 attached: function() { 33 attached: function() {
34 if (this.domHost && this.domHost.parentNode.tagName == 'PAPER-HEADER-PANEL') 34 if (this.domHost && this.domHost.parentNode.tagName == 'PAPER-HEADER-PANEL')
35 this.scroller = this.domHost.parentNode.scroller; 35 this.scroller = this.domHost.parentNode.scroller;
36 else 36 else
37 this.scroller = document.body; // Used in unit tests. 37 this.scroller = document.body; // Used in unit tests.
38 }, 38 },
39 39
40 /** 40 /**
41 * @param {!settings.Route} newRoute 41 * @param {!settings.Route} newRoute
42 * @param {!settings.Route} oldRoute 42 * @param {settings.Route} oldRoute
43 */ 43 */
44 currentRouteChanged: function(newRoute, oldRoute) { 44 currentRouteChanged: function(newRoute, oldRoute) {
45 var newRouteIsSubpage = newRoute && newRoute.subpage.length; 45 var newRouteIsSubpage = newRoute.isSubpage();
46 var oldRouteIsSubpage = oldRoute && oldRoute.subpage.length; 46 var oldRouteIsSubpage = oldRoute && oldRoute.isSubpage();
47 47
48 if (!oldRoute && newRouteIsSubpage) { 48 if (!oldRoute && newRouteIsSubpage) {
49 // Allow the page to load before expanding the section. TODO(michaelpg): 49 // Allow the page to load before expanding the section. TODO(michaelpg):
50 // Time this better when refactoring settings-animated-pages. 50 // Time this better when refactoring settings-animated-pages.
51 setTimeout(function() { 51 setTimeout(function() {
52 var section = this.getSection_(newRoute.section); 52 var section = this.getSection_(newRoute.section);
53 if (section) 53 if (section)
54 this.expandSection_(section); 54 this.expandSection_(section);
55 }.bind(this)); 55 }.bind(this));
56 return; 56 return;
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 this.$$('[section=' + section + ']')); 293 this.$$('[section=' + section + ']'));
294 }, 294 },
295 }; 295 };
296 296
297 /** @polymerBehavior */ 297 /** @polymerBehavior */
298 var MainPageBehavior = [ 298 var MainPageBehavior = [
299 settings.RouteObserverBehavior, 299 settings.RouteObserverBehavior,
300 TransitionBehavior, 300 TransitionBehavior,
301 MainPageBehaviorImpl, 301 MainPageBehaviorImpl,
302 ]; 302 ];
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698