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