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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 'printWithCloudPrint': destination != null && !destination.isLocal, | 161 'printWithCloudPrint': destination != null && !destination.isLocal, |
162 'deviceName': destination == null ? 'foo' : destination.id, | 162 'deviceName': destination == null ? 'foo' : destination.id, |
163 'generateDraftData': printTicketStore.isDocumentModifiable, | 163 'generateDraftData': printTicketStore.isDocumentModifiable, |
164 'fitToPageEnabled': printTicketStore.isFitToPageEnabled(), | 164 'fitToPageEnabled': printTicketStore.isFitToPageEnabled(), |
165 | 165 |
166 // NOTE: Even though the following fields don't directly relate to the | 166 // NOTE: Even though the following fields don't directly relate to the |
167 // preview, they still need to be included. | 167 // preview, they still need to be included. |
168 'duplex': printTicketStore.isDuplexEnabled() ? | 168 'duplex': printTicketStore.isDuplexEnabled() ? |
169 NativeLayer.DuplexMode.LONG_EDGE : NativeLayer.DuplexMode.SIMPLEX, | 169 NativeLayer.DuplexMode.LONG_EDGE : NativeLayer.DuplexMode.SIMPLEX, |
170 'copies': printTicketStore.getCopies(), | 170 'copies': printTicketStore.getCopies(), |
171 'collate': printTicketStore.isCollateEnabled() | 171 'collate': printTicketStore.isCollateEnabled(), |
| 172 'shouldPrintBackgrounds': printTicketStore.isCssBackgroundEnabled() |
172 }; | 173 }; |
173 | 174 |
174 // Set 'cloudPrintID' only if the destination is not local. | 175 // Set 'cloudPrintID' only if the destination is not local. |
175 if (!destination.isLocal) { | 176 if (!destination.isLocal) { |
176 ticket['cloudPrintID'] = destination.id; | 177 ticket['cloudPrintID'] = destination.id; |
177 } | 178 } |
178 | 179 |
179 if (printTicketStore.hasMarginsCapability() && | 180 if (printTicketStore.hasMarginsCapability() && |
180 printTicketStore.getMarginsType() == | 181 printTicketStore.getMarginsType() == |
181 print_preview.ticket_items.MarginsType.Value.CUSTOM) { | 182 print_preview.ticket_items.MarginsType.Value.CUSTOM) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 'landscape': printTicketStore.isLandscapeEnabled(), | 219 'landscape': printTicketStore.isLandscapeEnabled(), |
219 'color': printTicketStore.isColorEnabled() ? | 220 'color': printTicketStore.isColorEnabled() ? |
220 NativeLayer.ColorMode_.COLOR : NativeLayer.ColorMode_.GRAY, | 221 NativeLayer.ColorMode_.COLOR : NativeLayer.ColorMode_.GRAY, |
221 'headerFooterEnabled': printTicketStore.isHeaderFooterEnabled(), | 222 'headerFooterEnabled': printTicketStore.isHeaderFooterEnabled(), |
222 'marginsType': printTicketStore.getMarginsType(), | 223 'marginsType': printTicketStore.getMarginsType(), |
223 'generateDraftData': true, // TODO(rltoscano): What should this be? | 224 'generateDraftData': true, // TODO(rltoscano): What should this be? |
224 'duplex': printTicketStore.isDuplexEnabled() ? | 225 'duplex': printTicketStore.isDuplexEnabled() ? |
225 NativeLayer.DuplexMode.LONG_EDGE : NativeLayer.DuplexMode.SIMPLEX, | 226 NativeLayer.DuplexMode.LONG_EDGE : NativeLayer.DuplexMode.SIMPLEX, |
226 'copies': printTicketStore.getCopies(), | 227 'copies': printTicketStore.getCopies(), |
227 'collate': printTicketStore.isCollateEnabled(), | 228 'collate': printTicketStore.isCollateEnabled(), |
| 229 'shouldPrintBackgrounds': printTicketStore.isCssBackgroundEnabled(), |
228 'previewModifiable': printTicketStore.isDocumentModifiable, | 230 'previewModifiable': printTicketStore.isDocumentModifiable, |
229 'printToPDF': destination.id == | 231 'printToPDF': destination.id == |
230 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF, | 232 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF, |
231 'printWithCloudPrint': !destination.isLocal, | 233 'printWithCloudPrint': !destination.isLocal, |
232 'deviceName': destination.id, | 234 'deviceName': destination.id, |
233 'isFirstRequest': false, | 235 'isFirstRequest': false, |
234 'requestID': -1, | 236 'requestID': -1, |
235 'fitToPageEnabled': printTicketStore.isFitToPageEnabled() | 237 'fitToPageEnabled': printTicketStore.isFitToPageEnabled() |
236 }; | 238 }; |
237 | 239 |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 return this.serializedAppStateStr_; | 673 return this.serializedAppStateStr_; |
672 } | 674 } |
673 }; | 675 }; |
674 | 676 |
675 // Export | 677 // Export |
676 return { | 678 return { |
677 NativeInitialSettings: NativeInitialSettings, | 679 NativeInitialSettings: NativeInitialSettings, |
678 NativeLayer: NativeLayer | 680 NativeLayer: NativeLayer |
679 }; | 681 }; |
680 }); | 682 }); |
OLD | NEW |