OLD | NEW |
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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 return showBasicPage && !inSubpage; | 115 return showBasicPage && !inSubpage; |
116 }, | 116 }, |
117 | 117 |
118 /** | 118 /** |
119 * @private | 119 * @private |
120 */ | 120 */ |
121 currentRouteChanged_: function(newRoute) { | 121 currentRouteChanged_: function(newRoute) { |
122 this.inSubpage_ = newRoute.subpage.length > 0; | 122 this.inSubpage_ = newRoute.subpage.length > 0; |
123 this.style.height = this.inSubpage_ ? '100%' : ''; | 123 this.style.height = this.inSubpage_ ? '100%' : ''; |
124 | 124 |
125 if (newRoute.page == 'about') { | 125 if (settings.Route.ABOUT.contains(newRoute)) { |
126 this.showPages_ = {about: true, basic: false, advanced: false}; | 126 this.showPages_ = {about: true, basic: false, advanced: false}; |
127 } else { | 127 } else { |
128 this.showPages_ = { | 128 this.showPages_ = { |
129 about: false, | 129 about: false, |
130 basic: newRoute.page == 'basic' || !this.inSubpage_, | 130 basic: settings.Route.BASIC.contains(newRoute) || !this.inSubpage_, |
131 advanced: newRoute.page == 'advanced' || | 131 advanced: settings.Route.ADVANCED.contains(newRoute) || |
132 (!this.inSubpage_ && this.advancedToggleExpanded_), | 132 (!this.inSubpage_ && this.advancedToggleExpanded_), |
133 }; | 133 }; |
134 | 134 |
135 if (this.showPages_.advanced) { | 135 if (this.showPages_.advanced) { |
136 assert(!this.pageVisibility || | 136 assert(!this.pageVisibility || |
137 this.pageVisibility.advancedSettings !== false); | 137 this.pageVisibility.advancedSettings !== false); |
138 this.advancedToggleExpanded_ = true; | 138 this.advancedToggleExpanded_ = true; |
139 } | 139 } |
140 } | 140 } |
141 | 141 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 | 241 |
242 /** | 242 /** |
243 * @param {(boolean|undefined)} visibility | 243 * @param {(boolean|undefined)} visibility |
244 * @return {boolean} True unless visibility is false. | 244 * @return {boolean} True unless visibility is false. |
245 * @private | 245 * @private |
246 */ | 246 */ |
247 showAdvancedSettings_: function(visibility) { | 247 showAdvancedSettings_: function(visibility) { |
248 return visibility !== false; | 248 return visibility !== false; |
249 }, | 249 }, |
250 }); | 250 }); |
OLD | NEW |