| 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. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 return true; | 31 return true; |
| 32 }, | 32 }, |
| 33 | 33 |
| 34 /** @override */ | 34 /** @override */ |
| 35 isCapabilityAvailable: function() { | 35 isCapabilityAvailable: function() { |
| 36 return !!this.getCollateCapability_(); | 36 return !!this.getCollateCapability_(); |
| 37 }, | 37 }, |
| 38 | 38 |
| 39 /** @override */ | 39 /** @override */ |
| 40 getDefaultValueInternal: function() { | 40 getDefaultValueInternal: function() { |
| 41 return this.getCollateCapability_().default || false; | 41 var capability = this.getCollateCapability_(); |
| 42 return capability.hasOwnProperty('default') ? capability.default : true; |
| 42 }, | 43 }, |
| 43 | 44 |
| 44 /** @override */ | 45 /** @override */ |
| 45 getCapabilityNotAvailableValueInternal: function() { | 46 getCapabilityNotAvailableValueInternal: function() { |
| 46 return false; | 47 return true; |
| 47 }, | 48 }, |
| 48 | 49 |
| 49 /** | 50 /** |
| 50 * @return {Object} Collate capability of the selected destination. | 51 * @return {Object} Collate capability of the selected destination. |
| 51 * @private | 52 * @private |
| 52 */ | 53 */ |
| 53 getCollateCapability_: function() { | 54 getCollateCapability_: function() { |
| 54 var dest = this.getSelectedDestInternal(); | 55 var dest = this.getSelectedDestInternal(); |
| 55 return (dest && | 56 return (dest && |
| 56 dest.capabilities && | 57 dest.capabilities && |
| 57 dest.capabilities.printer && | 58 dest.capabilities.printer && |
| 58 dest.capabilities.printer.collate) || | 59 dest.capabilities.printer.collate) || |
| 59 null; | 60 null; |
| 60 } | 61 } |
| 61 }; | 62 }; |
| 62 | 63 |
| 63 // Export | 64 // Export |
| 64 return { | 65 return { |
| 65 Collate: Collate | 66 Collate: Collate |
| 66 }; | 67 }; |
| 67 }); | 68 }); |
| OLD | NEW |