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.exportPath('print_preview'); | 5 cr.exportPath('print_preview'); |
6 | 6 |
7 /** | 7 /** |
8 * @typedef {{selectSaveAsPdfDestination: boolean, | 8 * @typedef {{selectSaveAsPdfDestination: boolean, |
9 * layoutSettings.portrait: boolean, | 9 * layoutSettings.portrait: boolean, |
10 * pageRange: string, | 10 * pageRange: string, |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 'generateDraftData': documentInfo.isModifiable, | 305 'generateDraftData': documentInfo.isModifiable, |
306 'fitToPageEnabled': printTicketStore.fitToPage.getValue(), | 306 'fitToPageEnabled': printTicketStore.fitToPage.getValue(), |
307 'scaleFactor': printTicketStore.scaling.getValueAsNumber(), | 307 'scaleFactor': printTicketStore.scaling.getValueAsNumber(), |
308 // NOTE: Even though the following fields don't directly relate to the | 308 // NOTE: Even though the following fields don't directly relate to the |
309 // preview, they still need to be included. | 309 // preview, they still need to be included. |
310 'duplex': printTicketStore.duplex.getValue() ? | 310 'duplex': printTicketStore.duplex.getValue() ? |
311 NativeLayer.DuplexMode.LONG_EDGE : NativeLayer.DuplexMode.SIMPLEX, | 311 NativeLayer.DuplexMode.LONG_EDGE : NativeLayer.DuplexMode.SIMPLEX, |
312 'copies': 1, | 312 'copies': 1, |
313 'collate': true, | 313 'collate': true, |
314 'rasterizePDF': false, | 314 'rasterizePDF': false, |
| 315 'dpiHorizontal': "horizontal_dpi" in printTicketStore.dpi.getValue() ? |
| 316 printTicketStore.dpi.getValue().horizontal_dpi : 0, |
| 317 'dpiVertical': "vertical_dpi" in printTicketStore.dpi.getValue() ? |
| 318 printTicketStore.dpi.getValue().vertical_dpi : 0, |
315 'shouldPrintBackgrounds': printTicketStore.cssBackground.getValue(), | 319 'shouldPrintBackgrounds': printTicketStore.cssBackground.getValue(), |
316 'shouldPrintSelectionOnly': printTicketStore.selectionOnly.getValue() | 320 'shouldPrintSelectionOnly': printTicketStore.selectionOnly.getValue() |
317 }; | 321 }; |
318 | 322 |
319 // Set 'cloudPrintID' only if the destination is not local. | 323 // Set 'cloudPrintID' only if the destination is not local. |
320 if (destination && !destination.isLocal) { | 324 if (destination && !destination.isLocal) { |
321 ticket['cloudPrintID'] = destination.id; | 325 ticket['cloudPrintID'] = destination.id; |
322 } | 326 } |
323 | 327 |
324 if (printTicketStore.marginsType.isCapabilityAvailable() && | 328 if (printTicketStore.marginsType.isCapabilityAvailable() && |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 'shouldPrintBackgrounds': printTicketStore.cssBackground.getValue(), | 384 'shouldPrintBackgrounds': printTicketStore.cssBackground.getValue(), |
381 'shouldPrintSelectionOnly': printTicketStore.selectionOnly.getValue(), | 385 'shouldPrintSelectionOnly': printTicketStore.selectionOnly.getValue(), |
382 'previewModifiable': documentInfo.isModifiable, | 386 'previewModifiable': documentInfo.isModifiable, |
383 'printToPDF': destination.id == | 387 'printToPDF': destination.id == |
384 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF, | 388 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF, |
385 'printWithCloudPrint': !destination.isLocal, | 389 'printWithCloudPrint': !destination.isLocal, |
386 'printWithPrivet': destination.isPrivet, | 390 'printWithPrivet': destination.isPrivet, |
387 'printWithExtension': destination.isExtension, | 391 'printWithExtension': destination.isExtension, |
388 'rasterizePDF': printTicketStore.rasterize.getValue(), | 392 'rasterizePDF': printTicketStore.rasterize.getValue(), |
389 'scaleFactor': printTicketStore.scaling.getValueAsNumber(), | 393 'scaleFactor': printTicketStore.scaling.getValueAsNumber(), |
| 394 'dpiHorizontal': "horizontal_dpi" in printTicketStore.dpi.getValue() ? |
| 395 printTicketStore.dpi.getValue().horizontal_dpi : 0, |
| 396 'dpiVertical': "vertical_dpi" in printTicketStore.dpi.getValue() ? |
| 397 printTicketStore.dpi.getValue().vertical_dpi : 0, |
390 'deviceName': destination.id, | 398 'deviceName': destination.id, |
391 'isFirstRequest': false, | 399 'isFirstRequest': false, |
392 'requestID': -1, | 400 'requestID': -1, |
393 'fitToPageEnabled': printTicketStore.fitToPage.getValue(), | 401 'fitToPageEnabled': printTicketStore.fitToPage.getValue(), |
394 'pageWidth': documentInfo.pageSize.width, | 402 'pageWidth': documentInfo.pageSize.width, |
395 'pageHeight': documentInfo.pageSize.height, | 403 'pageHeight': documentInfo.pageSize.height, |
396 'showSystemDialog': opt_showSystemDialog | 404 'showSystemDialog': opt_showSystemDialog |
397 }; | 405 }; |
398 | 406 |
399 if (!destination.isLocal) { | 407 if (!destination.isLocal) { |
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1101 return this.serializedDefaultDestinationSelectionRulesStr_; | 1109 return this.serializedDefaultDestinationSelectionRulesStr_; |
1102 } | 1110 } |
1103 }; | 1111 }; |
1104 | 1112 |
1105 // Export | 1113 // Export |
1106 return { | 1114 return { |
1107 NativeInitialSettings: NativeInitialSettings, | 1115 NativeInitialSettings: NativeInitialSettings, |
1108 NativeLayer: NativeLayer | 1116 NativeLayer: NativeLayer |
1109 }; | 1117 }; |
1110 }); | 1118 }); |
OLD | NEW |