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.ticket_items', function() { | 5 cr.define('print_preview.ticket_items', function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 /** | 8 /** |
9 * Duplex ticket item whose value is a {@code boolean} that indicates whether | 9 * Duplex ticket item whose value is a {@code boolean} that indicates whether |
10 * the document should be duplex printed. | 10 * the document should be duplex printed. |
11 * @param {!print_preview.AppState} appState App state used to persist collate | 11 * @param {!print_preview.AppState} appState App state used to persist collate |
12 * selection. | 12 * selection. |
13 * @param {!print_preview.DestinationStore} destinationStore Destination store | 13 * @param {!print_preview.DestinationStore} destinationStore Destination store |
14 * used determine if a destination has the collate capability. | 14 * used determine if a destination has the collate capability. |
15 * @constructor | 15 * @constructor |
16 * @extends {print_preview.ticket_items.TicketItem} | 16 * @extends {print_preview.ticket_items.TicketItem} |
17 */ | 17 */ |
18 function Duplex(appState, destinationStore) { | 18 function Duplex(appState, destinationStore) { |
19 print_preview.ticket_items.TicketItem.call( | 19 print_preview.ticket_items.TicketItem.call( |
20 this, | 20 this, appState, print_preview.AppStateField.IS_DUPLEX_ENABLED, |
21 appState, | |
22 print_preview.AppStateField.IS_DUPLEX_ENABLED, | |
23 destinationStore); | 21 destinationStore); |
24 } | 22 } |
25 | 23 |
26 Duplex.prototype = { | 24 Duplex.prototype = { |
27 __proto__: print_preview.ticket_items.TicketItem.prototype, | 25 __proto__: print_preview.ticket_items.TicketItem.prototype, |
28 | 26 |
29 /** @override */ | 27 /** @override */ |
30 wouldValueBeValid: function(value) { | 28 wouldValueBeValid: function(value) { |
31 return true; | 29 return true; |
32 }, | 30 }, |
(...skipping 27 matching lines...) Expand all Loading... |
60 getCapabilityNotAvailableValueInternal: function() { | 58 getCapabilityNotAvailableValueInternal: function() { |
61 return false; | 59 return false; |
62 }, | 60 }, |
63 | 61 |
64 /** | 62 /** |
65 * @return {Object} Duplex capability of the selected destination. | 63 * @return {Object} Duplex capability of the selected destination. |
66 * @private | 64 * @private |
67 */ | 65 */ |
68 getDuplexCapability_: function() { | 66 getDuplexCapability_: function() { |
69 var dest = this.getSelectedDestInternal(); | 67 var dest = this.getSelectedDestInternal(); |
70 return (dest && | 68 return (dest && dest.capabilities && dest.capabilities.printer && |
71 dest.capabilities && | |
72 dest.capabilities.printer && | |
73 dest.capabilities.printer.duplex) || | 69 dest.capabilities.printer.duplex) || |
74 null; | 70 null; |
75 } | 71 } |
76 }; | 72 }; |
77 | 73 |
78 // Export | 74 // Export |
79 return { | 75 return {Duplex: Duplex}; |
80 Duplex: Duplex | |
81 }; | |
82 }); | 76 }); |
OLD | NEW |