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

Side by Side Diff: chrome/browser/resources/settings/settings_main/settings_main.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: merge 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 * @typedef {{about: boolean, basic: boolean, advanced: boolean}} 6 * @typedef {{about: boolean, basic: boolean, advanced: boolean}}
7 */ 7 */
8 var MainPageVisibility; 8 var MainPageVisibility;
9 9
10 /** 10 /**
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 * @return {boolean} 130 * @return {boolean}
131 * @private 131 * @private
132 */ 132 */
133 showAdvancedToggle_: function() { 133 showAdvancedToggle_: function() {
134 var inSearchMode = !!this.previousShowPages_; 134 var inSearchMode = !!this.previousShowPages_;
135 return this.showPages_.basic && !this.inSubpage_ && !inSearchMode; 135 return this.showPages_.basic && !this.inSubpage_ && !inSearchMode;
136 }, 136 },
137 137
138 /** @protected */ 138 /** @protected */
139 currentRouteChanged: function(newRoute) { 139 currentRouteChanged: function(newRoute) {
140 this.inSubpage_ = newRoute.subpage.length > 0; 140 this.inSubpage_ = newRoute.isSubpage();
141 this.style.height = this.inSubpage_ ? '100%' : ''; 141 this.style.height = this.inSubpage_ ? '100%' : '';
142 142
143 if (settings.Route.ABOUT.contains(newRoute)) { 143 if (settings.Route.ABOUT.contains(newRoute)) {
144 this.showPages_ = {about: true, basic: false, advanced: false}; 144 this.showPages_ = {about: true, basic: false, advanced: false};
145 } else { 145 } else {
146 this.showPages_ = { 146 this.showPages_ = {
147 about: false, 147 about: false,
148 basic: settings.Route.BASIC.contains(newRoute) || !this.inSubpage_, 148 basic: settings.Route.BASIC.contains(newRoute) || !this.inSubpage_,
149 advanced: settings.Route.ADVANCED.contains(newRoute) || 149 advanced: settings.Route.ADVANCED.contains(newRoute) ||
150 (!this.inSubpage_ && this.advancedToggleExpanded_), 150 (!this.inSubpage_ && this.advancedToggleExpanded_),
(...skipping 18 matching lines...) Expand all
169 /** 169 /**
170 * Return the height that the overscroll padding should be set to. 170 * Return the height that the overscroll padding should be set to.
171 * This is used to determine how much padding to apply to the end of the 171 * This is used to determine how much padding to apply to the end of the
172 * content so that the last element may align with the top of the content 172 * content so that the last element may align with the top of the content
173 * area. 173 * area.
174 * @return {number} 174 * @return {number}
175 * @private 175 * @private
176 */ 176 */
177 overscrollHeight_: function() { 177 overscrollHeight_: function() {
178 var route = settings.getCurrentRoute(); 178 var route = settings.getCurrentRoute();
179 if (route.subpage.length != 0 || this.showPages_.about) 179 if (route.isSubpage() || this.showPages_.about)
180 return 0; 180 return 0;
181 181
182 var query = 'settings-section[section="' + route.section + '"]'; 182 var query = 'settings-section[section="' + route.section + '"]';
183 var topSection = this.$$('settings-basic-page').$$(query); 183 var topSection = this.$$('settings-basic-page').$$(query);
184 if (!topSection && this.showPages_.advanced) 184 if (!topSection && this.showPages_.advanced)
185 topSection = this.$$('settings-advanced-page').$$(query); 185 topSection = this.$$('settings-advanced-page').$$(query);
186 186
187 if (!topSection || !topSection.offsetParent) 187 if (!topSection || !topSection.offsetParent)
188 return 0; 188 return 0;
189 189
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 259
260 /** 260 /**
261 * @param {(boolean|undefined)} visibility 261 * @param {(boolean|undefined)} visibility
262 * @return {boolean} True unless visibility is false. 262 * @return {boolean} True unless visibility is false.
263 * @private 263 * @private
264 */ 264 */
265 showAdvancedSettings_: function(visibility) { 265 showAdvancedSettings_: function(visibility) {
266 return visibility !== false; 266 return visibility !== false;
267 }, 267 },
268 }); 268 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698