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

Side by Side Diff: chrome/browser/resources/settings/settings_page/settings_animated_pages.js

Issue 1878653002: MD Settings: allow subpages not wrapped in templates (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 4 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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-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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 120
121 /** 121 /**
122 * Ensures that the template enclosing the subpage is stamped. 122 * Ensures that the template enclosing the subpage is stamped.
123 * @private 123 * @private
124 */ 124 */
125 ensureSubpageInstance_: function() { 125 ensureSubpageInstance_: function() {
126 var id = this.currentRoute.subpage.slice(-1)[0]; 126 var id = this.currentRoute.subpage.slice(-1)[0];
127 var template = Polymer.dom(this).querySelector( 127 var template = Polymer.dom(this).querySelector(
128 'template[name="' + id + '"]'); 128 'template[name="' + id + '"]');
129 129
130 // Do nothing if the subpage is already stamped. 130 // Nothing to do if the subpage isn't wrapped in a <template> or the
131 if (template.if) 131 // template is already stamped.
132 if (!template || template.if)
132 return; 133 return;
133 134
134 // Set the subpage's id for use by neon-animated-pages. 135 // Set the subpage's id for use by neon-animated-pages.
135 var subpage = /** @type {{_content: DocumentFragment}} */(template)._content 136 var subpage = /** @type {{_content: DocumentFragment}} */(template)._content
136 .querySelector('settings-subpage'); 137 .querySelector('settings-subpage');
137 if (!subpage.id) 138 if (!subpage.id)
138 subpage.id = id; 139 subpage.id = id;
139 140
140 // Render synchronously so neon-animated-pages can select the subpage. 141 // Render synchronously so neon-animated-pages can select the subpage.
141 template.if = true; 142 template.if = true;
142 template.render(); 143 template.render();
143 }, 144 },
144 145
145 /** 146 /**
146 * Buttons in this pageset should use this method to transition to subpages. 147 * Buttons in this pageset should use this method to transition to subpages.
147 */ 148 */
148 setSubpageChain: function(subpage) { 149 setSubpageChain: function(subpage) {
149 this.currentRoute = { 150 this.currentRoute = {
150 page: this.currentRoute.page, 151 page: this.currentRoute.page,
151 section: subpage.length > 0 ? this.section : '', 152 section: subpage.length > 0 ? this.section : '',
152 subpage: subpage, 153 subpage: subpage,
153 }; 154 };
154 }, 155 },
155 }); 156 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698