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-basic-page' is the settings page containing the actual settings. | 7 * 'settings-basic-page' is the settings page containing the actual settings. |
8 */ | 8 */ |
9 Polymer({ | 9 Polymer({ |
10 is: 'settings-basic-page', | 10 is: 'settings-basic-page', |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 }, | 108 }, |
109 | 109 |
110 /** | 110 /** |
111 * Overrides MainPageBehaviorImpl from MainPageBehavior. | 111 * Overrides MainPageBehaviorImpl from MainPageBehavior. |
112 * @param {!settings.Route} newRoute | 112 * @param {!settings.Route} newRoute |
113 * @param {settings.Route} oldRoute | 113 * @param {settings.Route} oldRoute |
114 */ | 114 */ |
115 currentRouteChanged: function(newRoute, oldRoute) { | 115 currentRouteChanged: function(newRoute, oldRoute) { |
116 this.currentRoute_ = newRoute; | 116 this.currentRoute_ = newRoute; |
117 | 117 |
118 if (settings.Route.ADVANCED.contains(newRoute)) | 118 if (settings.routes.ADVANCED && settings.routes.ADVANCED.contains(newRoute)) |
119 this.advancedToggleExpanded = true; | 119 this.advancedToggleExpanded = true; |
120 | 120 |
121 if (oldRoute && oldRoute.isSubpage()) { | 121 if (oldRoute && oldRoute.isSubpage()) { |
122 // If the new route isn't the same expanded section, reset | 122 // If the new route isn't the same expanded section, reset |
123 // hasExpandedSection_ for the next transition. | 123 // hasExpandedSection_ for the next transition. |
124 if (!newRoute.isSubpage() || newRoute.section != oldRoute.section) | 124 if (!newRoute.isSubpage() || newRoute.section != oldRoute.section) |
125 this.hasExpandedSection_ = false; | 125 this.hasExpandedSection_ = false; |
126 } else { | 126 } else { |
127 assert(!this.hasExpandedSection_); | 127 assert(!this.hasExpandedSection_); |
128 } | 128 } |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 | 251 |
252 /** | 252 /** |
253 * @param {!settings.Route} currentRoute | 253 * @param {!settings.Route} currentRoute |
254 * @param {boolean} inSearchMode | 254 * @param {boolean} inSearchMode |
255 * @param {boolean} hasExpandedSection | 255 * @param {boolean} hasExpandedSection |
256 * @return {boolean} Whether to show the basic page, taking into account | 256 * @return {boolean} Whether to show the basic page, taking into account |
257 * both routing and search state. | 257 * both routing and search state. |
258 * @private | 258 * @private |
259 */ | 259 */ |
260 showBasicPage_: function(currentRoute, inSearchMode, hasExpandedSection) { | 260 showBasicPage_: function(currentRoute, inSearchMode, hasExpandedSection) { |
261 return !hasExpandedSection || settings.Route.BASIC.contains(currentRoute); | 261 return !hasExpandedSection || settings.routes.BASIC.contains(currentRoute); |
262 }, | 262 }, |
263 | 263 |
264 /** | 264 /** |
265 * @param {!settings.Route} currentRoute | 265 * @param {!settings.Route} currentRoute |
266 * @param {boolean} inSearchMode | 266 * @param {boolean} inSearchMode |
267 * @param {boolean} hasExpandedSection | 267 * @param {boolean} hasExpandedSection |
268 * @param {boolean} advancedToggleExpanded | 268 * @param {boolean} advancedToggleExpanded |
269 * @return {boolean} Whether to show the advanced page, taking into account | 269 * @return {boolean} Whether to show the advanced page, taking into account |
270 * both routing and search state. | 270 * both routing and search state. |
271 * @private | 271 * @private |
272 */ | 272 */ |
273 showAdvancedPage_: function( | 273 showAdvancedPage_: function( |
274 currentRoute, inSearchMode, hasExpandedSection, advancedToggleExpanded) { | 274 currentRoute, inSearchMode, hasExpandedSection, advancedToggleExpanded) { |
275 return hasExpandedSection ? settings.Route.ADVANCED.contains(currentRoute) : | 275 return hasExpandedSection ? |
276 advancedToggleExpanded || inSearchMode; | 276 (settings.routes.ADVANCED && |
| 277 settings.routes.ADVANCED.contains(currentRoute)) : |
| 278 advancedToggleExpanded || inSearchMode; |
277 }, | 279 }, |
278 | 280 |
279 /** | 281 /** |
280 * @param {(boolean|undefined)} visibility | 282 * @param {(boolean|undefined)} visibility |
281 * @return {boolean} True unless visibility is false. | 283 * @return {boolean} True unless visibility is false. |
282 * @private | 284 * @private |
283 */ | 285 */ |
284 showAdvancedSettings_: function(visibility) { | 286 showAdvancedSettings_: function(visibility) { |
285 return visibility !== false; | 287 return visibility !== false; |
286 }, | 288 }, |
287 | 289 |
288 /** | 290 /** |
289 * @param {boolean} opened Whether the menu is expanded. | 291 * @param {boolean} opened Whether the menu is expanded. |
290 * @return {string} Icon name. | 292 * @return {string} Icon name. |
291 * @private | 293 * @private |
292 */ | 294 */ |
293 getArrowIcon_: function(opened) { | 295 getArrowIcon_: function(opened) { |
294 return opened ? 'cr:arrow-drop-up' : 'cr:arrow-drop-down'; | 296 return opened ? 'cr:arrow-drop-up' : 'cr:arrow-drop-down'; |
295 }, | 297 }, |
296 }); | 298 }); |
OLD | NEW |