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

Side by Side Diff: chrome/browser/resources/settings/basic_page/basic_page.js

Issue 2754563002: MD Settings: Lazy load the contents of the "advanced" settings. (Closed)
Patch Set: Address comments. Created 3 years, 9 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
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-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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 * @param {string} query The text to search for. 107 * @param {string} query The text to search for.
108 * @return {!Promise<!settings.SearchResult>} A signal indicating that 108 * @return {!Promise<!settings.SearchResult>} A signal indicating that
109 * searching finished. 109 * searching finished.
110 */ 110 */
111 searchContents: function(query) { 111 searchContents: function(query) {
112 var whenSearchDone = [ 112 var whenSearchDone = [
113 settings.getSearchManager().search(query, assert(this.$$('#basicPage'))), 113 settings.getSearchManager().search(query, assert(this.$$('#basicPage'))),
114 ]; 114 ];
115 115
116 if (this.pageVisibility.advancedSettings !== false) { 116 if (this.pageVisibility.advancedSettings !== false) {
117 whenSearchDone.push(settings.getSearchManager().search( 117 whenSearchDone.push(this.$$('#advancedPageTemplate').get().then(
118 query, assert(this.$$('#advancedPageTemplate').get()))); 118 function(advancedPage) {
119 return settings.getSearchManager().search(query, advancedPage);
120 }));
119 } 121 }
120 122
121 return Promise.all(whenSearchDone).then(function(requests) { 123 return Promise.all(whenSearchDone).then(function(requests) {
122 // Combine the SearchRequests results to a single SearchResult object. 124 // Combine the SearchRequests results to a single SearchResult object.
123 return { 125 return {
124 canceled: requests.some(function(r) { return r.canceled; }), 126 canceled: requests.some(function(r) { return r.canceled; }),
125 didFindMatches: requests.every(function(r) { 127 didFindMatches: requests.every(function(r) {
126 return !r.didFindMatches(); 128 return !r.didFindMatches();
127 }), 129 }),
128 // All requests correspond to the same user query, so only need to check 130 // All requests correspond to the same user query, so only need to check
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 229
228 /** 230 /**
229 * @param {boolean} opened Whether the menu is expanded. 231 * @param {boolean} opened Whether the menu is expanded.
230 * @return {string} Icon name. 232 * @return {string} Icon name.
231 * @private 233 * @private
232 */ 234 */
233 getArrowIcon_: function(opened) { 235 getArrowIcon_: function(opened) {
234 return opened ? 'cr:arrow-drop-up' : 'cr:arrow-drop-down'; 236 return opened ? 'cr:arrow-drop-up' : 'cr:arrow-drop-down';
235 }, 237 },
236 }); 238 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698