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 * Collate ticket item whose value is a {@code boolean} that indicates whether | 9 * Collate ticket item whose value is a {@code boolean} that indicates whether |
10 * collation is enabled. | 10 * collation is enabled. |
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 Collate(appState, destinationStore) { | 18 function Collate(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_COLLATE_ENABLED, |
21 appState, | |
22 print_preview.AppStateField.IS_COLLATE_ENABLED, | |
23 destinationStore); | 21 destinationStore); |
24 } | 22 } |
25 | 23 |
26 Collate.prototype = { | 24 Collate.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 13 matching lines...) Expand all Loading... |
46 getCapabilityNotAvailableValueInternal: function() { | 44 getCapabilityNotAvailableValueInternal: function() { |
47 return true; | 45 return true; |
48 }, | 46 }, |
49 | 47 |
50 /** | 48 /** |
51 * @return {Object} Collate capability of the selected destination. | 49 * @return {Object} Collate capability of the selected destination. |
52 * @private | 50 * @private |
53 */ | 51 */ |
54 getCollateCapability_: function() { | 52 getCollateCapability_: function() { |
55 var dest = this.getSelectedDestInternal(); | 53 var dest = this.getSelectedDestInternal(); |
56 return (dest && | 54 return (dest && dest.capabilities && dest.capabilities.printer && |
57 dest.capabilities && | |
58 dest.capabilities.printer && | |
59 dest.capabilities.printer.collate) || | 55 dest.capabilities.printer.collate) || |
60 null; | 56 null; |
61 } | 57 } |
62 }; | 58 }; |
63 | 59 |
64 // Export | 60 // Export |
65 return { | 61 return {Collate: Collate}; |
66 Collate: Collate | |
67 }; | |
68 }); | 62 }); |
OLD | NEW |