OLD | NEW |
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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 * @protected | 220 * @protected |
221 */ | 221 */ |
222 renderListInternal: function(destinations) { | 222 renderListInternal: function(destinations) { |
223 setIsVisible(this.getChildElement('.no-destinations-message'), | 223 setIsVisible(this.getChildElement('.no-destinations-message'), |
224 destinations.length == 0); | 224 destinations.length == 0); |
225 setIsVisible(this.getChildElement('.destination-list > footer'), false); | 225 setIsVisible(this.getChildElement('.destination-list > footer'), false); |
226 var numItems = destinations.length; | 226 var numItems = destinations.length; |
227 if (destinations.length > this.shortListSize_ && !this.isShowAll_) { | 227 if (destinations.length > this.shortListSize_ && !this.isShowAll_) { |
228 numItems = this.shortListSize_ - 1; | 228 numItems = this.shortListSize_ - 1; |
229 this.getChildElement('.total').textContent = | 229 this.getChildElement('.total').textContent = |
230 localStrings.getStringF('destinationCount', destinations.length); | 230 loadTimeData.getStringF('destinationCount', destinations.length); |
231 setIsVisible(this.getChildElement('.destination-list > footer'), true); | 231 setIsVisible(this.getChildElement('.destination-list > footer'), true); |
232 } | 232 } |
233 for (var i = 0; i < numItems; i++) { | 233 for (var i = 0; i < numItems; i++) { |
234 var destListItem = new print_preview.DestinationListItem( | 234 var destListItem = new print_preview.DestinationListItem( |
235 this.eventTarget_, destinations[i], this.query_); | 235 this.eventTarget_, destinations[i], this.query_); |
236 this.addChild(destListItem); | 236 this.addChild(destListItem); |
237 destListItem.render(this.getChildElement('.destination-list > ul')); | 237 destListItem.render(this.getChildElement('.destination-list > ul')); |
238 } | 238 } |
239 }, | 239 }, |
240 | 240 |
(...skipping 24 matching lines...) Expand all Loading... |
265 cr.dispatchSimpleEvent(this, | 265 cr.dispatchSimpleEvent(this, |
266 DestinationList.EventType.ACTION_LINK_ACTIVATED); | 266 DestinationList.EventType.ACTION_LINK_ACTIVATED); |
267 } | 267 } |
268 }; | 268 }; |
269 | 269 |
270 // Export | 270 // Export |
271 return { | 271 return { |
272 DestinationList: DestinationList | 272 DestinationList: DestinationList |
273 }; | 273 }; |
274 }); | 274 }); |
OLD | NEW |