| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 if (!this.focusConfig || !this.previousRoute_) | 59 if (!this.focusConfig || !this.previousRoute_) |
| 60 return; | 60 return; |
| 61 | 61 |
| 62 // Don't attempt to focus any anchor element, unless last navigation was a | 62 // Don't attempt to focus any anchor element, unless last navigation was a |
| 63 // 'pop' (backwards) navigation. | 63 // 'pop' (backwards) navigation. |
| 64 if (!settings.lastRouteChangeWasPopstate()) | 64 if (!settings.lastRouteChangeWasPopstate()) |
| 65 return; | 65 return; |
| 66 | 66 |
| 67 // Only handle iron-select events from neon-animatable elements and the | 67 // Only handle iron-select events from neon-animatable elements and the |
| 68 // given whitelist of settings-subpage instances. | 68 // given whitelist of settings-subpage instances. |
| 69 var whitelist = 'settings-subpage#site-settings, ' + | 69 var whitelist = 'settings-subpage#site-settings'; |
| 70 'settings-subpage[route-path=\"' + | 70 |
| 71 settings.Route.SITE_SETTINGS_COOKIES.path + '\"]'; | 71 if (settings.routes.SITE_SETTINGS_COOKIES) { |
| 72 whitelist += ', settings-subpage[route-path=\"' + |
| 73 settings.routes.SITE_SETTINGS_COOKIES.path + '\"]'; |
| 74 } |
| 72 | 75 |
| 73 // <if expr="chromeos"> | 76 // <if expr="chromeos"> |
| 74 whitelist += ', settings-subpage[route-path=\"' + | 77 if (settings.routes.INTERNET_NETWORKS) { |
| 75 settings.Route.INTERNET_NETWORKS.path + '\"]'; | 78 whitelist += ', settings-subpage[route-path=\"' + |
| 79 settings.routes.INTERNET_NETWORKS.path + '\"]'; |
| 80 } |
| 76 // </if> | 81 // </if> |
| 77 | 82 |
| 78 if (!e.detail.item.matches('neon-animatable, ' + whitelist)) | 83 if (!e.detail.item.matches('neon-animatable, ' + whitelist)) |
| 79 return; | 84 return; |
| 80 | 85 |
| 81 var selector = this.focusConfig.get(this.previousRoute_.path); | 86 var selector = this.focusConfig.get(this.previousRoute_.path); |
| 82 if (selector) { | 87 if (selector) { |
| 83 // neon-animatable has "display: none" until the animation finishes, so | 88 // neon-animatable has "display: none" until the animation finishes, so |
| 84 // calling focus() on any of its children has no effect until "display: | 89 // calling focus() on any of its children has no effect until "display: |
| 85 // none" is removed. Therefore, don't set focus from within the | 90 // none" is removed. Therefore, don't set focus from within the |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 // instance, such that the stamped instance will also be ignored by the | 201 // instance, such that the stamped instance will also be ignored by the |
| 197 // searching algorithm. | 202 // searching algorithm. |
| 198 if (template.hasAttribute('no-search')) | 203 if (template.hasAttribute('no-search')) |
| 199 subpage.setAttribute('no-search', ''); | 204 subpage.setAttribute('no-search', ''); |
| 200 | 205 |
| 201 // Render synchronously so neon-animated-pages can select the subpage. | 206 // Render synchronously so neon-animated-pages can select the subpage. |
| 202 template.if = true; | 207 template.if = true; |
| 203 template.render(); | 208 template.render(); |
| 204 }, | 209 }, |
| 205 }); | 210 }); |
| OLD | NEW |