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

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

Issue 1125343004: Add a "Simplify Page" option to the print preview dialog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and remove custom URL source Created 5 years, 6 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.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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 destination, printTicketStore, documentInfo, requestId) { 266 destination, printTicketStore, documentInfo, requestId) {
267 assert(printTicketStore.isTicketValidForPreview(), 267 assert(printTicketStore.isTicketValidForPreview(),
268 'Trying to generate preview when ticket is not valid'); 268 'Trying to generate preview when ticket is not valid');
269 269
270 var ticket = { 270 var ticket = {
271 'pageRange': printTicketStore.pageRange.getDocumentPageRanges(), 271 'pageRange': printTicketStore.pageRange.getDocumentPageRanges(),
272 'mediaSize': printTicketStore.mediaSize.getValue(), 272 'mediaSize': printTicketStore.mediaSize.getValue(),
273 'landscape': printTicketStore.landscape.getValue(), 273 'landscape': printTicketStore.landscape.getValue(),
274 'color': this.getNativeColorModel_(destination, printTicketStore.color), 274 'color': this.getNativeColorModel_(destination, printTicketStore.color),
275 'headerFooterEnabled': printTicketStore.headerFooter.getValue(), 275 'headerFooterEnabled': printTicketStore.headerFooter.getValue(),
276 'printFriendly': printTicketStore.printFriendly.getValue(),
276 'marginsType': printTicketStore.marginsType.getValue(), 277 'marginsType': printTicketStore.marginsType.getValue(),
277 'isFirstRequest': requestId == 0, 278 'isFirstRequest': requestId == 0,
278 'requestID': requestId, 279 'requestID': requestId,
279 'previewModifiable': documentInfo.isModifiable, 280 'previewModifiable': documentInfo.isModifiable,
280 'printToPDF': 281 'printToPDF':
281 destination != null && 282 destination != null &&
282 destination.id == 283 destination.id ==
283 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF, 284 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF,
284 'printWithCloudPrint': destination != null && !destination.isLocal, 285 'printWithCloudPrint': destination != null && !destination.isLocal,
285 'printWithPrivet': destination != null && destination.isPrivet, 286 'printWithPrivet': destination != null && destination.isPrivet,
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 initialSettings['appKioskMode'] || false, 479 initialSettings['appKioskMode'] || false,
479 initialSettings['hidePrintWithSystemDialogLink'] || false, 480 initialSettings['hidePrintWithSystemDialogLink'] || false,
480 numberFormatSymbols[0] || ',', 481 numberFormatSymbols[0] || ',',
481 numberFormatSymbols[1] || '.', 482 numberFormatSymbols[1] || '.',
482 unitType, 483 unitType,
483 initialSettings['previewModifiable'] || false, 484 initialSettings['previewModifiable'] || false,
484 initialSettings['initiatorTitle'] || '', 485 initialSettings['initiatorTitle'] || '',
485 initialSettings['documentHasSelection'] || false, 486 initialSettings['documentHasSelection'] || false,
486 initialSettings['shouldPrintSelectionOnly'] || false, 487 initialSettings['shouldPrintSelectionOnly'] || false,
487 initialSettings['printerName'] || null, 488 initialSettings['printerName'] || null,
488 initialSettings['appState'] || null); 489 initialSettings['appState'] || null,
490 initialSettings['printFriendlyEnabled'] || false);
489 491
490 var initialSettingsSetEvent = new Event( 492 var initialSettingsSetEvent = new Event(
491 NativeLayer.EventType.INITIAL_SETTINGS_SET); 493 NativeLayer.EventType.INITIAL_SETTINGS_SET);
492 initialSettingsSetEvent.initialSettings = nativeInitialSettings; 494 initialSettingsSetEvent.initialSettings = nativeInitialSettings;
493 this.dispatchEvent(initialSettingsSetEvent); 495 this.dispatchEvent(initialSettingsSetEvent);
494 }, 496 },
495 497
496 /** 498 /**
497 * Turn on the integration of Cloud Print. 499 * Turn on the integration of Cloud Print.
498 * @param {{cloudPrintURL: string, appKioskMode: string}} settings 500 * @param {{cloudPrintURL: string, appKioskMode: string}} settings
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 * @param {boolean} isDocumentModifiable Whether the document to print is 910 * @param {boolean} isDocumentModifiable Whether the document to print is
909 * modifiable. 911 * modifiable.
910 * @param {string} documentTitle Title of the document. 912 * @param {string} documentTitle Title of the document.
911 * @param {boolean} documentHasSelection Whether the document has selected 913 * @param {boolean} documentHasSelection Whether the document has selected
912 * content. 914 * content.
913 * @param {boolean} selectionOnly Whether only selected content should be 915 * @param {boolean} selectionOnly Whether only selected content should be
914 * printed. 916 * printed.
915 * @param {?string} systemDefaultDestinationId ID of the system default 917 * @param {?string} systemDefaultDestinationId ID of the system default
916 * destination. 918 * destination.
917 * @param {?string} serializedAppStateStr Serialized app state. 919 * @param {?string} serializedAppStateStr Serialized app state.
920 * @param {boolean} printFriendlyEnabled Whether the print friendly setting is
921 * enabled.
918 * @constructor 922 * @constructor
919 */ 923 */
920 function NativeInitialSettings( 924 function NativeInitialSettings(
921 isInKioskAutoPrintMode, 925 isInKioskAutoPrintMode,
922 isInAppKioskMode, 926 isInAppKioskMode,
923 hidePrintWithSystemDialogLink, 927 hidePrintWithSystemDialogLink,
924 thousandsDelimeter, 928 thousandsDelimeter,
925 decimalDelimeter, 929 decimalDelimeter,
926 unitType, 930 unitType,
927 isDocumentModifiable, 931 isDocumentModifiable,
928 documentTitle, 932 documentTitle,
929 documentHasSelection, 933 documentHasSelection,
930 selectionOnly, 934 selectionOnly,
931 systemDefaultDestinationId, 935 systemDefaultDestinationId,
932 serializedAppStateStr) { 936 serializedAppStateStr,
937 printFriendlyEnabled) {
933 938
934 /** 939 /**
935 * Whether the print preview should be in auto-print mode. 940 * Whether the print preview should be in auto-print mode.
936 * @type {boolean} 941 * @type {boolean}
937 * @private 942 * @private
938 */ 943 */
939 this.isInKioskAutoPrintMode_ = isInKioskAutoPrintMode; 944 this.isInKioskAutoPrintMode_ = isInKioskAutoPrintMode;
940 945
941 /** 946 /**
942 * Whether the print preview should switch to App Kiosk mode. 947 * Whether the print preview should switch to App Kiosk mode.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 * @private 1012 * @private
1008 */ 1013 */
1009 this.systemDefaultDestinationId_ = systemDefaultDestinationId; 1014 this.systemDefaultDestinationId_ = systemDefaultDestinationId;
1010 1015
1011 /** 1016 /**
1012 * Serialized app state. 1017 * Serialized app state.
1013 * @type {?string} 1018 * @type {?string}
1014 * @private 1019 * @private
1015 */ 1020 */
1016 this.serializedAppStateStr_ = serializedAppStateStr; 1021 this.serializedAppStateStr_ = serializedAppStateStr;
1022
1023 /**
1024 * Whether the print friendly setting is enabled.
1025 * @type {boolean}
1026 * @private
1027 */
1028 this.printFriendlyEnabled_ = printFriendlyEnabled;
1017 }; 1029 };
1018 1030
1019 NativeInitialSettings.prototype = { 1031 NativeInitialSettings.prototype = {
1020 /** 1032 /**
1021 * @return {boolean} Whether the print preview should be in auto-print mode. 1033 * @return {boolean} Whether the print preview should be in auto-print mode.
1022 */ 1034 */
1023 get isInKioskAutoPrintMode() { 1035 get isInKioskAutoPrintMode() {
1024 return this.isInKioskAutoPrintMode_; 1036 return this.isInKioskAutoPrintMode_;
1025 }, 1037 },
1026 1038
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 }, 1091 },
1080 1092
1081 /** @return {?string} ID of the system default destination. */ 1093 /** @return {?string} ID of the system default destination. */
1082 get systemDefaultDestinationId() { 1094 get systemDefaultDestinationId() {
1083 return this.systemDefaultDestinationId_; 1095 return this.systemDefaultDestinationId_;
1084 }, 1096 },
1085 1097
1086 /** @return {?string} Serialized app state. */ 1098 /** @return {?string} Serialized app state. */
1087 get serializedAppStateStr() { 1099 get serializedAppStateStr() {
1088 return this.serializedAppStateStr_; 1100 return this.serializedAppStateStr_;
1089 } 1101 },
1102
1103 /**
1104 * @return {boolean} Whether the print friendly setting is enabled.
1105 */
1106 get printFriendlyEnabled() {
1107 return this.printFriendlyEnabled_;
1108 },
1109
1090 }; 1110 };
1091 1111
1092 // Export 1112 // Export
1093 return { 1113 return {
1094 NativeInitialSettings: NativeInitialSettings, 1114 NativeInitialSettings: NativeInitialSettings,
1095 NativeLayer: NativeLayer 1115 NativeLayer: NativeLayer
1096 }; 1116 };
1097 }); 1117 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698