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 * Copies ticket item whose value is a {@code string} that indicates how many | 9 * Copies ticket item whose value is a {@code string} that indicates how many |
10 * copies of the document should be printed. The ticket item is backed by a | 10 * copies of the document should be printed. The ticket item is backed by a |
(...skipping 29 matching lines...) Expand all Loading... |
40 }, | 40 }, |
41 | 41 |
42 /** @return {number} The number of copies indicated by the ticket item. */ | 42 /** @return {number} The number of copies indicated by the ticket item. */ |
43 getValueAsNumber: function() { | 43 getValueAsNumber: function() { |
44 return parseInt(this.getValue()); | 44 return parseInt(this.getValue()); |
45 }, | 45 }, |
46 | 46 |
47 /** @override */ | 47 /** @override */ |
48 getDefaultValueInternal: function() { | 48 getDefaultValueInternal: function() { |
49 var cap = this.getCopiesCapability_(); | 49 var cap = this.getCopiesCapability_(); |
50 return cap.hasOwnProperty('default') ? cap.default : ''; | 50 return cap.hasOwnProperty('default') ? cap.default : '1'; |
51 }, | 51 }, |
52 | 52 |
53 /** @override */ | 53 /** @override */ |
54 getCapabilityNotAvailableValueInternal: function() { | 54 getCapabilityNotAvailableValueInternal: function() { |
55 return '1'; | 55 return '1'; |
56 }, | 56 }, |
57 | 57 |
58 /** | 58 /** |
59 * @return {Object} Copies capability of the selected destination. | 59 * @return {Object} Copies capability of the selected destination. |
60 * @private | 60 * @private |
61 */ | 61 */ |
62 getCopiesCapability_: function() { | 62 getCopiesCapability_: function() { |
63 var dest = this.getSelectedDestInternal(); | 63 var dest = this.getSelectedDestInternal(); |
64 return (dest && | 64 return (dest && |
65 dest.capabilities && | 65 dest.capabilities && |
66 dest.capabilities.printer && | 66 dest.capabilities.printer && |
67 dest.capabilities.printer.copies) || | 67 dest.capabilities.printer.copies) || |
68 null; | 68 null; |
69 } | 69 } |
70 }; | 70 }; |
71 | 71 |
72 // Export | 72 // Export |
73 return { | 73 return { |
74 Copies: Copies | 74 Copies: Copies |
75 }; | 75 }; |
76 }); | 76 }); |
OLD | NEW |