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

Side by Side Diff: chrome/browser/resources/print_preview/search/destination_list.js

Issue 595423002: Take search query into account rendering recent destination list items. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | chrome/browser/resources/print_preview/search/recent_destination_list.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 cr.define('print_preview', function() { 5 cr.define('print_preview', function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * Component that displays a list of destinations with a heading, action link, 9 * Component that displays a list of destinations with a heading, action link,
10 * and "Show All..." button. An event is dispatched when the action link is 10 * and "Show All..." button. An event is dispatched when the action link is
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 setIsVisible(this.getChildElement('.no-destinations-message'), 224 setIsVisible(this.getChildElement('.no-destinations-message'),
225 destinations.length == 0); 225 destinations.length == 0);
226 setIsVisible(this.getChildElement('.destination-list > footer'), false); 226 setIsVisible(this.getChildElement('.destination-list > footer'), false);
227 var numItems = destinations.length; 227 var numItems = destinations.length;
228 if (destinations.length > this.shortListSize_ && !this.isShowAll_) { 228 if (destinations.length > this.shortListSize_ && !this.isShowAll_) {
229 numItems = this.shortListSize_ - 1; 229 numItems = this.shortListSize_ - 1;
230 this.getChildElement('.total').textContent = 230 this.getChildElement('.total').textContent =
231 loadTimeData.getStringF('destinationCount', destinations.length); 231 loadTimeData.getStringF('destinationCount', destinations.length);
232 setIsVisible(this.getChildElement('.destination-list > footer'), true); 232 setIsVisible(this.getChildElement('.destination-list > footer'), true);
233 } 233 }
234 for (var i = 0; i < numItems; i++) { 234 for (var i = 0; i < numItems; i++)
235 var destListItem = new print_preview.DestinationListItem( 235 this.renderListItemInternal(destinations[i]);
236 this.eventTarget_, destinations[i], this.query_);
237 this.addChild(destListItem);
238 destListItem.render(this.getChildElement('.destination-list > ul'));
239 }
240 }, 236 },
241 237
242 /** 238 /**
239 * @param {!print_preview.Destination} destination Destination to render.
240 * @protected
241 */
242 renderListItemInternal: function(destination) {
243 var listItem = new print_preview.DestinationListItem(
244 this.eventTarget_, destination, this.query_);
245 this.addChild(listItem);
246 listItem.render(this.getChildElement('.destination-list > ul'));
247 },
248
249 /**
243 * Renders all destinations in the list that match the current query. For 250 * Renders all destinations in the list that match the current query. For
244 * each render, all old destination items are first removed. 251 * each render, all old destination items are first removed.
245 * @private 252 * @private
246 */ 253 */
247 renderDestinations_: function() { 254 renderDestinations_: function() {
248 this.removeChildren(); 255 this.removeChildren();
249 256
250 if (!this.query_) { 257 if (!this.query_) {
251 this.renderListInternal(this.destinations_); 258 this.renderListInternal(this.destinations_);
252 } else { 259 } else {
(...skipping 13 matching lines...) Expand all
266 cr.dispatchSimpleEvent(this, 273 cr.dispatchSimpleEvent(this,
267 DestinationList.EventType.ACTION_LINK_ACTIVATED); 274 DestinationList.EventType.ACTION_LINK_ACTIVATED);
268 } 275 }
269 }; 276 };
270 277
271 // Export 278 // Export
272 return { 279 return {
273 DestinationList: DestinationList 280 DestinationList: DestinationList
274 }; 281 };
275 }); 282 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/print_preview/search/recent_destination_list.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698