| Index: chrome/browser/resources/print_preview/native_layer.js
|
| diff --git a/chrome/browser/resources/print_preview/native_layer.js b/chrome/browser/resources/print_preview/native_layer.js
|
| index efdd55b36073695ca5a34c475a299e408e7ea0a9..0111ccd3b778b70283e398e87278bba04bd2e35d 100644
|
| --- a/chrome/browser/resources/print_preview/native_layer.js
|
| +++ b/chrome/browser/resources/print_preview/native_layer.js
|
| @@ -168,6 +168,23 @@ cr.define('print_preview', function() {
|
| },
|
|
|
| /**
|
| + * @param {!print_preview.Destination} destination Destination to print to.
|
| + * @param {!print_preview.ticket_items.Color} color Color ticket item.
|
| + * @return {number} Native layer color model.
|
| + * @private
|
| + */
|
| + getNativeColorModel_: function(destination, color) {
|
| + // For non-local printers native color model is ignored anyway.
|
| + var option = destination.isLocal ? color.getSelectedOption() : null;
|
| + var nativeColorModel = parseInt(option ? option.vendor_id : null);
|
| + if (isNaN(nativeColorModel)) {
|
| + return color.getValue() ?
|
| + NativeLayer.ColorMode_.COLOR : NativeLayer.ColorMode_.GRAY;
|
| + }
|
| + return nativeColorModel;
|
| + },
|
| +
|
| + /**
|
| * Requests that a preview be generated. The following events may be
|
| * dispatched in response:
|
| * - PAGE_COUNT_READY
|
| @@ -190,8 +207,7 @@ cr.define('print_preview', function() {
|
| 'pageRange': printTicketStore.pageRange.getDocumentPageRanges(),
|
| 'mediaSize': printTicketStore.mediaSize.getValue(),
|
| 'landscape': printTicketStore.landscape.getValue(),
|
| - 'color': printTicketStore.color.getValue() ?
|
| - NativeLayer.ColorMode_.COLOR : NativeLayer.ColorMode_.GRAY,
|
| + 'color': this.getNativeColorModel_(destination, printTicketStore.color),
|
| 'headerFooterEnabled': printTicketStore.headerFooter.getValue(),
|
| 'marginsType': printTicketStore.marginsType.getValue(),
|
| 'isFirstRequest': requestId == 0,
|
| @@ -263,8 +279,7 @@ cr.define('print_preview', function() {
|
| 'pageRange': printTicketStore.pageRange.getDocumentPageRanges(),
|
| 'pageCount': printTicketStore.pageRange.getPageNumberSet().size,
|
| 'landscape': printTicketStore.landscape.getValue(),
|
| - 'color': printTicketStore.color.getValue() ?
|
| - NativeLayer.ColorMode_.COLOR : NativeLayer.ColorMode_.GRAY,
|
| + 'color': this.getNativeColorModel_(destination, printTicketStore.color),
|
| 'headerFooterEnabled': printTicketStore.headerFooter.getValue(),
|
| 'marginsType': printTicketStore.marginsType.getValue(),
|
| 'generateDraftData': true, // TODO(rltoscano): What should this be?
|
|
|