| 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-animated-pages' is a container for a page and animated subpages. | 7 * 'settings-animated-pages' is a container for a page and animated subpages. |
| 8 * It provides a set of common behaviors and animations. | 8 * It provides a set of common behaviors and animations. |
| 9 * | 9 * |
| 10 * Example: | 10 * Example: |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 /** @private */ | 82 /** @private */ |
| 83 currentRouteChanged_: function(newRoute, oldRoute) { | 83 currentRouteChanged_: function(newRoute, oldRoute) { |
| 84 // Don't manipulate the light DOM until it's ready. | 84 // Don't manipulate the light DOM until it's ready. |
| 85 if (!this.lightDomReady_) { | 85 if (!this.lightDomReady_) { |
| 86 this.queuedRouteChange_ = this.queuedRouteChange_ || {oldRoute: oldRoute}; | 86 this.queuedRouteChange_ = this.queuedRouteChange_ || {oldRoute: oldRoute}; |
| 87 this.queuedRouteChange_.newRoute = newRoute; | 87 this.queuedRouteChange_.newRoute = newRoute; |
| 88 return; | 88 return; |
| 89 } | 89 } |
| 90 | 90 |
| 91 // route.section is only non-empty when the user is within a subpage. | 91 var newRouteIsSubpage = newRoute && newRoute.subpage.length; |
| 92 // When the user is not in a subpage, but on the Basic page, route.section | 92 var oldRouteIsSubpage = oldRoute && oldRoute.subpage.length; |
| 93 // is an empty string. | |
| 94 var newRouteIsSubpage = newRoute && newRoute.section == this.section; | |
| 95 var oldRouteIsSubpage = oldRoute && oldRoute.section == this.section; | |
| 96 | 93 |
| 97 if (newRouteIsSubpage) | 94 if (newRouteIsSubpage) |
| 98 this.ensureSubpageInstance_(); | 95 this.ensureSubpageInstance_(); |
| 99 | 96 |
| 100 if (!newRouteIsSubpage || !oldRouteIsSubpage || | 97 if (!newRouteIsSubpage || !oldRouteIsSubpage || |
| 101 newRoute.subpage.length == oldRoute.subpage.length) { | 98 newRoute.subpage.length == oldRoute.subpage.length) { |
| 102 // If two routes are at the same level, or if either the new or old route | 99 // If two routes are at the same level, or if either the new or old route |
| 103 // is not a subpage, fade in and out. | 100 // is not a subpage, fade in and out. |
| 104 this.$.animatedPages.exitAnimation = 'fade-out-animation'; | 101 this.$.animatedPages.exitAnimation = 'fade-out-animation'; |
| 105 this.$.animatedPages.entryAnimation = 'fade-in-animation'; | 102 this.$.animatedPages.entryAnimation = 'fade-in-animation'; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 * Buttons in this pageset should use this method to transition to subpages. | 144 * Buttons in this pageset should use this method to transition to subpages. |
| 148 */ | 145 */ |
| 149 setSubpageChain: function(subpage) { | 146 setSubpageChain: function(subpage) { |
| 150 this.currentRoute = { | 147 this.currentRoute = { |
| 151 page: this.currentRoute.page, | 148 page: this.currentRoute.page, |
| 152 section: subpage.length > 0 ? this.section : '', | 149 section: subpage.length > 0 ? this.section : '', |
| 153 subpage: subpage, | 150 subpage: subpage, |
| 154 }; | 151 }; |
| 155 }, | 152 }, |
| 156 }); | 153 }); |
| OLD | NEW |