Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(324)

Side by Side Diff: chrome/browser/resources/print_preview/native_layer.js

Issue 11818062: Adds option to enable CSS backgrounds for printing. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Merge with trunk. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 return this.serializedAppStateStr_; 678 return this.serializedAppStateStr_;
677 } 679 }
678 }; 680 };
679 681
680 // Export 682 // Export
681 return { 683 return {
682 NativeInitialSettings: NativeInitialSettings, 684 NativeInitialSettings: NativeInitialSettings,
683 NativeLayer: NativeLayer 685 NativeLayer: NativeLayer
684 }; 686 };
685 }); 687 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698