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', function() { | 5 cr.define('print_preview', function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 /** | 8 /** |
9 * An interface to the native Chromium printing system layer. | 9 * An interface to the native Chromium printing system layer. |
10 * @constructor | 10 * @constructor |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 'marginsType': printTicketStore.getMarginsType(), | 142 'marginsType': printTicketStore.getMarginsType(), |
143 'isFirstRequest': requestId == 0, | 143 'isFirstRequest': requestId == 0, |
144 'requestID': requestId, | 144 'requestID': requestId, |
145 'previewModifiable': printTicketStore.isDocumentModifiable, | 145 'previewModifiable': printTicketStore.isDocumentModifiable, |
146 'printToPDF': | 146 'printToPDF': |
147 destination != null && | 147 destination != null && |
148 destination.id == | 148 destination.id == |
149 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF, | 149 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF, |
150 'printWithCloudPrint': destination != null && !destination.isLocal, | 150 'printWithCloudPrint': destination != null && !destination.isLocal, |
151 'deviceName': destination == null ? 'foo' : destination.id, | 151 'deviceName': destination == null ? 'foo' : destination.id, |
152 'cloudPrintID': destination == null ? 'foo' : destination.id, | |
153 'generateDraftData': printTicketStore.isDocumentModifiable, | 152 'generateDraftData': printTicketStore.isDocumentModifiable, |
154 'fitToPageEnabled': printTicketStore.isFitToPageEnabled(), | 153 'fitToPageEnabled': printTicketStore.isFitToPageEnabled(), |
155 | 154 |
156 // NOTE: Even though the following fields don't directly relate to the | 155 // NOTE: Even though the following fields don't directly relate to the |
157 // preview, they still need to be included. | 156 // preview, they still need to be included. |
158 'duplex': printTicketStore.isDuplexEnabled() ? | 157 'duplex': printTicketStore.isDuplexEnabled() ? |
159 NativeLayer.DuplexMode.LONG_EDGE : NativeLayer.DuplexMode.SIMPLEX, | 158 NativeLayer.DuplexMode.LONG_EDGE : NativeLayer.DuplexMode.SIMPLEX, |
160 'copies': printTicketStore.getCopies(), | 159 'copies': printTicketStore.getCopies(), |
161 'collate': printTicketStore.isCollateEnabled() | 160 'collate': printTicketStore.isCollateEnabled() |
162 }; | 161 }; |
163 | 162 |
| 163 // Set 'cloudPrintID' only if the destination is not local. |
| 164 if (!destination.isLocal) |
| 165 ticket['cloudPrintID'] = destination.id; |
| 166 |
164 if (printTicketStore.hasMarginsCapability() && | 167 if (printTicketStore.hasMarginsCapability() && |
165 printTicketStore.getMarginsType() == | 168 printTicketStore.getMarginsType() == |
166 print_preview.ticket_items.MarginsType.Value.CUSTOM) { | 169 print_preview.ticket_items.MarginsType.Value.CUSTOM) { |
167 var customMargins = printTicketStore.getCustomMargins(); | 170 var customMargins = printTicketStore.getCustomMargins(); |
168 var orientationEnum = | 171 var orientationEnum = |
169 print_preview.ticket_items.CustomMargins.Orientation; | 172 print_preview.ticket_items.CustomMargins.Orientation; |
170 ticket['marginsCustom'] = { | 173 ticket['marginsCustom'] = { |
171 'marginTop': customMargins.get(orientationEnum.TOP), | 174 'marginTop': customMargins.get(orientationEnum.TOP), |
172 'marginRight': customMargins.get(orientationEnum.RIGHT), | 175 'marginRight': customMargins.get(orientationEnum.RIGHT), |
173 'marginBottom': customMargins.get(orientationEnum.BOTTOM), | 176 'marginBottom': customMargins.get(orientationEnum.BOTTOM), |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 return this.initialDestinationId_; | 740 return this.initialDestinationId_; |
738 } | 741 } |
739 }; | 742 }; |
740 | 743 |
741 // Export | 744 // Export |
742 return { | 745 return { |
743 NativeInitialSettings: NativeInitialSettings, | 746 NativeInitialSettings: NativeInitialSettings, |
744 NativeLayer: NativeLayer | 747 NativeLayer: NativeLayer |
745 }; | 748 }; |
746 }); | 749 }); |
OLD | NEW |