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

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

Issue 208583007: Tunnel the CDD from the Print Preview javascript to the privet operation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 'previewModifiable': documentInfo.isModifiable, 276 'previewModifiable': documentInfo.isModifiable,
277 'printToPDF': destination.id == 277 'printToPDF': destination.id ==
278 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF, 278 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF,
279 'printWithCloudPrint': !destination.isLocal, 279 'printWithCloudPrint': !destination.isLocal,
280 'printWithPrivet': destination.isPrivet, 280 'printWithPrivet': destination.isPrivet,
281 'deviceName': destination.id, 281 'deviceName': destination.id,
282 'isFirstRequest': false, 282 'isFirstRequest': false,
283 'requestID': -1, 283 'requestID': -1,
284 'fitToPageEnabled': printTicketStore.fitToPage.getValue(), 284 'fitToPageEnabled': printTicketStore.fitToPage.getValue(),
285 'pageWidth': documentInfo.pageSize.width, 285 'pageWidth': documentInfo.pageSize.width,
286 'pageHeight': documentInfo.pageSize.height, 286 'pageHeight': documentInfo.pageSize.height
287 }; 287 };
288 288
289 if (!destination.isLocal) { 289 if (!destination.isLocal) {
290 // We can't set cloudPrintID if the destination is "Print with Cloud 290 // We can't set cloudPrintID if the destination is "Print with Cloud
291 // Print" because the native system will try to print to Google Cloud 291 // Print" because the native system will try to print to Google Cloud
292 // Print with this ID instead of opening a Google Cloud Print dialog. 292 // Print with this ID instead of opening a Google Cloud Print dialog.
293 ticket['cloudPrintID'] = destination.id; 293 ticket['cloudPrintID'] = destination.id;
294 } 294 }
295 295
296 if (printTicketStore.marginsType.isCapabilityAvailable() && 296 if (printTicketStore.marginsType.isCapabilityAvailable() &&
297 printTicketStore.marginsType.isValueEqual( 297 printTicketStore.marginsType.isValueEqual(
298 print_preview.ticket_items.MarginsType.Value.CUSTOM)) { 298 print_preview.ticket_items.MarginsType.Value.CUSTOM)) {
299 var customMargins = printTicketStore.customMargins.getValue(); 299 var customMargins = printTicketStore.customMargins.getValue();
300 var orientationEnum = 300 var orientationEnum =
301 print_preview.ticket_items.CustomMargins.Orientation; 301 print_preview.ticket_items.CustomMargins.Orientation;
302 ticket['marginsCustom'] = { 302 ticket['marginsCustom'] = {
303 'marginTop': customMargins.get(orientationEnum.TOP), 303 'marginTop': customMargins.get(orientationEnum.TOP),
304 'marginRight': customMargins.get(orientationEnum.RIGHT), 304 'marginRight': customMargins.get(orientationEnum.RIGHT),
305 'marginBottom': customMargins.get(orientationEnum.BOTTOM), 305 'marginBottom': customMargins.get(orientationEnum.BOTTOM),
306 'marginLeft': customMargins.get(orientationEnum.LEFT) 306 'marginLeft': customMargins.get(orientationEnum.LEFT)
307 }; 307 };
308 } 308 }
309 309
310 if (destination.isPrivet) { 310 if (destination.isPrivet) {
311 ticket['ticket'] = printTicketStore.createPrintTicket(destination); 311 ticket['ticket'] = printTicketStore.createPrintTicket(destination);
312 ticket['capabilities'] = JSON.stringify(destination.capabilities);
312 } 313 }
313 314
314 if (opt_isOpenPdfInPreview) { 315 if (opt_isOpenPdfInPreview) {
315 ticket['OpenPDFInPreview'] = true; 316 ticket['OpenPDFInPreview'] = true;
316 } 317 }
317 318
318 chrome.send('print', [JSON.stringify(ticket)]); 319 chrome.send('print', [JSON.stringify(ticket)]);
319 }, 320 },
320 321
321 /** Requests that the current pending print request be cancelled. */ 322 /** Requests that the current pending print request be cancelled. */
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 return this.serializedAppStateStr_; 847 return this.serializedAppStateStr_;
847 } 848 }
848 }; 849 };
849 850
850 // Export 851 // Export
851 return { 852 return {
852 NativeInitialSettings: NativeInitialSettings, 853 NativeInitialSettings: NativeInitialSettings,
853 NativeLayer: NativeLayer 854 NativeLayer: NativeLayer
854 }; 855 };
855 }); 856 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698