| OLD | NEW |
| (Empty) | |
| 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. |
| 4 |
| 5 cr.define('print_preview', function() { |
| 6 'use strict'; |
| 7 |
| 8 /** |
| 9 * Sub-class of a destination list that shows cloud-based destinations. |
| 10 * @param {!cr.EventTarget} eventTarget Event target to pass to destination |
| 11 * items for dispatching SELECT events. |
| 12 * @constructor |
| 13 * @extends {print_preview.DestinationList} |
| 14 */ |
| 15 function CloudDestinationList(eventTarget) { |
| 16 print_preview.DestinationList.call( |
| 17 this, |
| 18 eventTarget, |
| 19 localStrings.getString('cloudDestinationsTitle'), |
| 20 0 /*opt_maxSize*/, |
| 21 localStrings.getString('manage')); |
| 22 }; |
| 23 |
| 24 CloudDestinationList.prototype = { |
| 25 __proto__: print_preview.DestinationList.prototype, |
| 26 |
| 27 /** @override */ |
| 28 updateDestinations: function(destinations) { |
| 29 // Change the action link from "Manage..." to "Setup..." if user only has |
| 30 // Docs and FedEx printers. |
| 31 var docsId = print_preview.Destination.GooglePromotedId.DOCS; |
| 32 var fedexId = print_preview.Destination.GooglePromotedId.FEDEX; |
| 33 if ((destinations.length == 1 && destinations[0].id == docsId) || |
| 34 (destinations.length == 2 && |
| 35 ((destinations[0].id == docsId && destinations[1].id == fedexId) || |
| 36 (destinations[0].id == fedexId && destinations[1].id == docsId)))) { |
| 37 this.setActionLinkTextInternal( |
| 38 localStrings.getString('setupCloudPrinters')); |
| 39 } else { |
| 40 this.setActionLinkTextInternal(localStrings.getString('manage')); |
| 41 } |
| 42 print_preview.DestinationList.prototype.updateDestinations.call( |
| 43 this, destinations); |
| 44 } |
| 45 }; |
| 46 |
| 47 return { |
| 48 CloudDestinationList: CloudDestinationList |
| 49 }; |
| 50 }); |
| OLD | NEW |