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

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: fix tests 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 * @fileoverview 6 * @fileoverview
7 * 'settings-main' displays the selected settings page. 7 * 'settings-main' displays the selected settings page.
8 */ 8 */
9 Polymer({ 9 Polymer({
10 is: 'settings-main', 10 is: 'settings-main',
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 * @param {boolean} inSubpage 116 * @param {boolean} inSubpage
117 * @return {boolean} 117 * @return {boolean}
118 * @private 118 * @private
119 */ 119 */
120 showAdvancedToggle_: function(showBasicPage, inSubpage) { 120 showAdvancedToggle_: function(showBasicPage, inSubpage) {
121 return showBasicPage && !inSubpage; 121 return showBasicPage && !inSubpage;
122 }, 122 },
123 123
124 /** @protected */ 124 /** @protected */
125 currentRouteChanged: function(newRoute) { 125 currentRouteChanged: function(newRoute) {
126 this.inSubpage_ = newRoute.subpage.length > 0; 126 this.inSubpage_ = newRoute.isSubpage();
127 this.style.height = this.inSubpage_ ? '100%' : ''; 127 this.style.height = this.inSubpage_ ? '100%' : '';
michaelpg 2016/08/10 18:45:52 inSubpage_ really means whether a subpage contains
tommycli 2016/08/10 18:52:17 Yeah, I'll just suggest that dialogs can never be
128 128
129 if (settings.Route.ABOUT.contains(newRoute)) { 129 if (settings.Route.ABOUT.contains(newRoute)) {
130 this.showPages_ = {about: true, basic: false, advanced: false}; 130 this.showPages_ = {about: true, basic: false, advanced: false};
131 } else { 131 } else {
132 this.showPages_ = { 132 this.showPages_ = {
133 about: false, 133 about: false,
134 basic: settings.Route.BASIC.contains(newRoute) || !this.inSubpage_, 134 basic: settings.Route.BASIC.contains(newRoute) || !this.inSubpage_,
135 advanced: settings.Route.ADVANCED.contains(newRoute) || 135 advanced: settings.Route.ADVANCED.contains(newRoute) ||
136 (!this.inSubpage_ && this.advancedToggleExpanded_), 136 (!this.inSubpage_ && this.advancedToggleExpanded_),
137 }; 137 };
(...skipping 17 matching lines...) Expand all
155 /** 155 /**
156 * Return the height that the overscroll padding should be set to. 156 * Return the height that the overscroll padding should be set to.
157 * This is used to determine how much padding to apply to the end of the 157 * This is used to determine how much padding to apply to the end of the
158 * content so that the last element may align with the top of the content 158 * content so that the last element may align with the top of the content
159 * area. 159 * area.
160 * @return {number} 160 * @return {number}
161 * @private 161 * @private
162 */ 162 */
163 overscrollHeight_: function() { 163 overscrollHeight_: function() {
164 var route = settings.getCurrentRoute(); 164 var route = settings.getCurrentRoute();
165 if (route.subpage.length != 0 || this.showPages_.about) 165 if (route.isSubpage() || this.showPages_.about)
166 return 0; 166 return 0;
167 167
168 var query = 'settings-section[section="' + route.section + '"]'; 168 var query = 'settings-section[section="' + route.section + '"]';
169 var topSection = this.$$('settings-basic-page').$$(query); 169 var topSection = this.$$('settings-basic-page').$$(query);
170 if (!topSection && this.showPages_.advanced) 170 if (!topSection && this.showPages_.advanced)
171 topSection = this.$$('settings-advanced-page').$$(query); 171 topSection = this.$$('settings-advanced-page').$$(query);
172 172
173 if (!topSection || !topSection.offsetParent) 173 if (!topSection || !topSection.offsetParent)
174 return 0; 174 return 0;
175 175
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 232
233 /** 233 /**
234 * @param {(boolean|undefined)} visibility 234 * @param {(boolean|undefined)} visibility
235 * @return {boolean} True unless visibility is false. 235 * @return {boolean} True unless visibility is false.
236 * @private 236 * @private
237 */ 237 */
238 showAdvancedSettings_: function(visibility) { 238 showAdvancedSettings_: function(visibility) {
239 return visibility !== false; 239 return visibility !== false;
240 }, 240 },
241 }); 241 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698