| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 * An object that represents a user modifiable item in a print ticket. Each | 9 * An object that represents a user modifiable item in a print ticket. Each |
| 10 * ticket item has a value which can be set by the user. Ticket items can also | 10 * ticket item has a value which can be set by the user. Ticket items can also |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 for (var key in this.items_) { | 56 for (var key in this.items_) { |
| 57 if (this.items_.hasOwnProperty(key)) | 57 if (this.items_.hasOwnProperty(key)) |
| 58 return true; | 58 return true; |
| 59 } | 59 } |
| 60 return false; | 60 return false; |
| 61 }, | 61 }, |
| 62 | 62 |
| 63 /** @return {Object} Vendor capabilities of the selected destination. */ | 63 /** @return {Object} Vendor capabilities of the selected destination. */ |
| 64 get capability() { | 64 get capability() { |
| 65 var destination = this.destinationStore_ ? | 65 var destination = this.destinationStore_ ? |
| 66 this.destinationStore_.selectedDestination : null; | 66 this.destinationStore_.selectedDestination : |
| 67 null; |
| 67 if (!destination) | 68 if (!destination) |
| 68 return null; | 69 return null; |
| 69 if (destination.id == print_preview.Destination.GooglePromotedId.FEDEX || | 70 if (destination.id == print_preview.Destination.GooglePromotedId.FEDEX || |
| 70 destination.type == print_preview.Destination.Type.MOBILE) { | 71 destination.type == print_preview.Destination.Type.MOBILE) { |
| 71 return null; | 72 return null; |
| 72 } | 73 } |
| 73 return (destination.capabilities && | 74 return (destination.capabilities && destination.capabilities.printer && |
| 74 destination.capabilities.printer && | |
| 75 destination.capabilities.printer.vendor_capability) || | 75 destination.capabilities.printer.vendor_capability) || |
| 76 null; | 76 null; |
| 77 }, | 77 }, |
| 78 | 78 |
| 79 /** | 79 /** |
| 80 * Vendor ticket items store, maps item id to the item value. | 80 * Vendor ticket items store, maps item id to the item value. |
| 81 * @return {!Object<string>} | 81 * @return {!Object<string>} |
| 82 */ | 82 */ |
| 83 get ticketItems() { | 83 get ticketItems() { |
| 84 return this.items_; | 84 return this.items_; |
| 85 }, | 85 }, |
| 86 | 86 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 100 } | 100 } |
| 101 | 101 |
| 102 if (this.appState_) { | 102 if (this.appState_) { |
| 103 this.appState_.persistField( | 103 this.appState_.persistField( |
| 104 print_preview.AppState.Field.VENDOR_OPTIONS, this.items_); | 104 print_preview.AppState.Field.VENDOR_OPTIONS, this.items_); |
| 105 } | 105 } |
| 106 } | 106 } |
| 107 }; | 107 }; |
| 108 | 108 |
| 109 // Export | 109 // Export |
| 110 return { | 110 return {VendorItems: VendorItems}; |
| 111 VendorItems: VendorItems | |
| 112 }; | |
| 113 }); | 111 }); |
| OLD | NEW |