Move Webstore URL concepts to //extensions and out
[chromium-blink-merge.git] / chrome / browser / resources / print_preview / search / recent_destination_list.js
blob74d8a990becfbac0b3d32f6a30c36a183a5b5864
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
3 // found in the LICENSE file.
5 cr.define('print_preview', function() {
6 'use strict';
8 /**
9 * Sub-class of a destination list that shows recent destinations. This list
10 * does not render a "Show all" button.
11 * @param {!cr.EventTarget} eventTarget Event target to pass to destination
12 * items for dispatching SELECT events.
13 * @constructor
14 * @extends {print_preview.DestinationList}
16 function RecentDestinationList(eventTarget) {
17 print_preview.DestinationList.call(
18 this,
19 eventTarget,
20 localStrings.getString('recentDestinationsTitle'));
23 RecentDestinationList.prototype = {
24 __proto__: print_preview.DestinationList.prototype,
26 /** @override */
27 updateShortListSize: function(size) {
28 this.setShortListSizeInternal(
29 Math.max(1, Math.min(size, this.getDestinationsCount())));
32 /** @override */
33 renderListInternal: function(destinations) {
34 setIsVisible(this.getChildElement('.no-destinations-message'),
35 destinations.length == 0);
36 setIsVisible(this.getChildElement('.destination-list > footer'), false);
37 var numItems = Math.min(destinations.length, this.shortListSize_);
38 for (var i = 0; i < numItems; i++) {
39 var destListItem = new print_preview.DestinationListItem(
40 this.eventTarget_, destinations[i]);
41 this.addChild(destListItem);
42 destListItem.render(this.getChildElement('.destination-list > ul'));
47 return {
48 RecentDestinationList: RecentDestinationList
50 });