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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 // preview, they still need to be included. | 175 // preview, they still need to be included. |
176 'duplex': printTicketStore.duplex.getValue() ? | 176 'duplex': printTicketStore.duplex.getValue() ? |
177 NativeLayer.DuplexMode.LONG_EDGE : NativeLayer.DuplexMode.SIMPLEX, | 177 NativeLayer.DuplexMode.LONG_EDGE : NativeLayer.DuplexMode.SIMPLEX, |
178 'copies': printTicketStore.copies.getValueAsNumber(), | 178 'copies': printTicketStore.copies.getValueAsNumber(), |
179 'collate': printTicketStore.collate.getValue(), | 179 'collate': printTicketStore.collate.getValue(), |
180 'shouldPrintBackgrounds': printTicketStore.cssBackground.getValue(), | 180 'shouldPrintBackgrounds': printTicketStore.cssBackground.getValue(), |
181 'shouldPrintSelectionOnly': printTicketStore.selectionOnly.getValue() | 181 'shouldPrintSelectionOnly': printTicketStore.selectionOnly.getValue() |
182 }; | 182 }; |
183 | 183 |
184 // Set 'cloudPrintID' only if the destination is not local. | 184 // Set 'cloudPrintID' only if the destination is not local. |
185 if (!destination.isLocal) { | 185 if (destination && !destination.isLocal) { |
186 ticket['cloudPrintID'] = destination.id; | 186 ticket['cloudPrintID'] = destination.id; |
187 } | 187 } |
188 | 188 |
189 if (printTicketStore.hasMarginsCapability() && | 189 if (printTicketStore.hasMarginsCapability() && |
190 printTicketStore.getMarginsType() == | 190 printTicketStore.getMarginsType() == |
191 print_preview.ticket_items.MarginsType.Value.CUSTOM) { | 191 print_preview.ticket_items.MarginsType.Value.CUSTOM) { |
192 var customMargins = printTicketStore.getCustomMargins(); | 192 var customMargins = printTicketStore.getCustomMargins(); |
193 var orientationEnum = | 193 var orientationEnum = |
194 print_preview.ticket_items.CustomMargins.Orientation; | 194 print_preview.ticket_items.CustomMargins.Orientation; |
195 ticket['marginsCustom'] = { | 195 ticket['marginsCustom'] = { |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 return this.serializedAppStateStr_; | 737 return this.serializedAppStateStr_; |
738 } | 738 } |
739 }; | 739 }; |
740 | 740 |
741 // Export | 741 // Export |
742 return { | 742 return { |
743 NativeInitialSettings: NativeInitialSettings, | 743 NativeInitialSettings: NativeInitialSettings, |
744 NativeLayer: NativeLayer | 744 NativeLayer: NativeLayer |
745 }; | 745 }; |
746 }); | 746 }); |
OLD | NEW |