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

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

Issue 2863183004: Print Preview: Fix top level directory compile errors (Closed)
Patch Set: Address comments Created 3 years, 7 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 global.onExtensionCapabilitiesSet = 72 global.onExtensionCapabilitiesSet =
73 this.onExtensionCapabilitiesSet_.bind(this); 73 this.onExtensionCapabilitiesSet_.bind(this);
74 global.onEnableManipulateSettingsForTest = 74 global.onEnableManipulateSettingsForTest =
75 this.onEnableManipulateSettingsForTest_.bind(this); 75 this.onEnableManipulateSettingsForTest_.bind(this);
76 global.printPresetOptionsFromDocument = 76 global.printPresetOptionsFromDocument =
77 this.onPrintPresetOptionsFromDocument_.bind(this); 77 this.onPrintPresetOptionsFromDocument_.bind(this);
78 global.onProvisionalPrinterResolved = 78 global.onProvisionalPrinterResolved =
79 this.onProvisionalDestinationResolved_.bind(this); 79 this.onProvisionalDestinationResolved_.bind(this);
80 global.failedToResolveProvisionalPrinter = 80 global.failedToResolveProvisionalPrinter =
81 this.failedToResolveProvisionalDestination_.bind(this); 81 this.failedToResolveProvisionalDestination_.bind(this);
82 }; 82 }
83 83
84 /** 84 /**
85 * Event types dispatched from the Chromium native layer. 85 * Event types dispatched from the Chromium native layer.
86 * @enum {string} 86 * @enum {string}
87 * @const 87 * @const
88 */ 88 */
89 NativeLayer.EventType = { 89 NativeLayer.EventType = {
90 ACCESS_TOKEN_READY: 'print_preview.NativeLayer.ACCESS_TOKEN_READY', 90 ACCESS_TOKEN_READY: 'print_preview.NativeLayer.ACCESS_TOKEN_READY',
91 CAPABILITIES_SET: 'print_preview.NativeLayer.CAPABILITIES_SET', 91 CAPABILITIES_SET: 'print_preview.NativeLayer.CAPABILITIES_SET',
92 CLOUD_PRINT_ENABLE: 'print_preview.NativeLayer.CLOUD_PRINT_ENABLE', 92 CLOUD_PRINT_ENABLE: 'print_preview.NativeLayer.CLOUD_PRINT_ENABLE',
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 'previewModifiable': documentInfo.isModifiable, 296 'previewModifiable': documentInfo.isModifiable,
297 'generateDraftData': documentInfo.isModifiable, 297 'generateDraftData': documentInfo.isModifiable,
298 'fitToPageEnabled': printTicketStore.fitToPage.getValue(), 298 'fitToPageEnabled': printTicketStore.fitToPage.getValue(),
299 'scaleFactor': printTicketStore.scaling.getValueAsNumber(), 299 'scaleFactor': printTicketStore.scaling.getValueAsNumber(),
300 // NOTE: Even though the following fields don't directly relate to the 300 // NOTE: Even though the following fields don't directly relate to the
301 // preview, they still need to be included. 301 // preview, they still need to be included.
302 // e.g. printing::PrintSettingsFromJobSettings() still checks for them. 302 // e.g. printing::PrintSettingsFromJobSettings() still checks for them.
303 'collate': true, 303 'collate': true,
304 'copies': 1, 304 'copies': 1,
305 'deviceName': destination.id, 305 'deviceName': destination.id,
306 'dpiHorizontal': "horizontal_dpi" in printTicketStore.dpi.getValue() ? 306 'dpiHorizontal': 'horizontal_dpi' in printTicketStore.dpi.getValue() ?
307 printTicketStore.dpi.getValue().horizontal_dpi : 0, 307 printTicketStore.dpi.getValue().horizontal_dpi : 0,
308 'dpiVertical': "vertical_dpi" in printTicketStore.dpi.getValue() ? 308 'dpiVertical': 'vertical_dpi' in printTicketStore.dpi.getValue() ?
309 printTicketStore.dpi.getValue().vertical_dpi : 0, 309 printTicketStore.dpi.getValue().vertical_dpi : 0,
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 'printToPDF': destination.id == 312 'printToPDF': destination.id ==
313 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF, 313 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF,
314 'printWithCloudPrint': !destination.isLocal, 314 'printWithCloudPrint': !destination.isLocal,
315 'printWithPrivet': destination.isPrivet, 315 'printWithPrivet': destination.isPrivet,
316 'printWithExtension': destination.isExtension, 316 'printWithExtension': destination.isExtension,
317 'rasterizePDF': false, 317 'rasterizePDF': false,
318 'shouldPrintBackgrounds': printTicketStore.cssBackground.getValue(), 318 'shouldPrintBackgrounds': printTicketStore.cssBackground.getValue(),
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 'shouldPrintBackgrounds': printTicketStore.cssBackground.getValue(), 381 'shouldPrintBackgrounds': printTicketStore.cssBackground.getValue(),
382 'shouldPrintSelectionOnly': false, // Only used in print preview 382 'shouldPrintSelectionOnly': false, // Only used in print preview
383 'previewModifiable': documentInfo.isModifiable, 383 'previewModifiable': documentInfo.isModifiable,
384 'printToPDF': destination.id == 384 'printToPDF': destination.id ==
385 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF, 385 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF,
386 'printWithCloudPrint': !destination.isLocal, 386 'printWithCloudPrint': !destination.isLocal,
387 'printWithPrivet': destination.isPrivet, 387 'printWithPrivet': destination.isPrivet,
388 'printWithExtension': destination.isExtension, 388 'printWithExtension': destination.isExtension,
389 'rasterizePDF': printTicketStore.rasterize.getValue(), 389 'rasterizePDF': printTicketStore.rasterize.getValue(),
390 'scaleFactor': printTicketStore.scaling.getValueAsNumber(), 390 'scaleFactor': printTicketStore.scaling.getValueAsNumber(),
391 'dpiHorizontal': "horizontal_dpi" in printTicketStore.dpi.getValue() ? 391 'dpiHorizontal': 'horizontal_dpi' in printTicketStore.dpi.getValue() ?
392 printTicketStore.dpi.getValue().horizontal_dpi : 0, 392 printTicketStore.dpi.getValue().horizontal_dpi : 0,
393 'dpiVertical': "vertical_dpi" in printTicketStore.dpi.getValue() ? 393 'dpiVertical': 'vertical_dpi' in printTicketStore.dpi.getValue() ?
394 printTicketStore.dpi.getValue().vertical_dpi : 0, 394 printTicketStore.dpi.getValue().vertical_dpi : 0,
395 'deviceName': destination.id, 395 'deviceName': destination.id,
396 'fitToPageEnabled': printTicketStore.fitToPage.getValue(), 396 'fitToPageEnabled': printTicketStore.fitToPage.getValue(),
397 'pageWidth': documentInfo.pageSize.width, 397 'pageWidth': documentInfo.pageSize.width,
398 'pageHeight': documentInfo.pageSize.height, 398 'pageHeight': documentInfo.pageSize.height,
399 'showSystemDialog': opt_showSystemDialog 399 'showSystemDialog': opt_showSystemDialog
400 }; 400 };
401 401
402 if (!destination.isLocal) { 402 if (!destination.isLocal) {
403 // We can't set cloudPrintID if the destination is "Print with Cloud 403 // We can't set cloudPrintID if the destination is "Print with Cloud
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 isDocumentModifiable, 946 isDocumentModifiable,
947 documentTitle, 947 documentTitle,
948 documentHasSelection, 948 documentHasSelection,
949 selectionOnly, 949 selectionOnly,
950 systemDefaultDestinationId, 950 systemDefaultDestinationId,
951 serializedAppStateStr, 951 serializedAppStateStr,
952 serializedDefaultDestinationSelectionRulesStr) { 952 serializedDefaultDestinationSelectionRulesStr) {
953 953
954 /** 954 /**
955 * Whether the print preview should be in auto-print mode. 955 * Whether the print preview should be in auto-print mode.
956 * @type {boolean} 956 * @private {boolean}
957 * @private
958 */ 957 */
959 this.isInKioskAutoPrintMode_ = isInKioskAutoPrintMode; 958 this.isInKioskAutoPrintMode_ = isInKioskAutoPrintMode;
960 959
961 /** 960 /**
962 * Whether the print preview should switch to App Kiosk mode. 961 * Whether the print preview should switch to App Kiosk mode.
963 * @type {boolean} 962 * @private {boolean}
964 * @private
965 */ 963 */
966 this.isInAppKioskMode_ = isInAppKioskMode; 964 this.isInAppKioskMode_ = isInAppKioskMode;
967 965
968 /** 966 /**
969 * Character delimeter of thousands digits. 967 * Character delimeter of thousands digits.
970 * @type {string} 968 * @private {string}
971 * @private
972 */ 969 */
973 this.thousandsDelimeter_ = thousandsDelimeter; 970 this.thousandsDelimeter_ = thousandsDelimeter;
974 971
975 /** 972 /**
976 * Character delimeter of the decimal point. 973 * Character delimeter of the decimal point.
977 * @type {string} 974 * @private {string}
978 * @private
979 */ 975 */
980 this.decimalDelimeter_ = decimalDelimeter; 976 this.decimalDelimeter_ = decimalDelimeter;
981 977
982 /** 978 /**
983 * Unit type of local machine's measurement system. 979 * Unit type of local machine's measurement system.
984 * @type {print_preview.MeasurementSystemUnitType} 980 * @private {print_preview.MeasurementSystemUnitType}
985 * @private
986 */ 981 */
987 this.unitType_ = unitType; 982 this.unitType_ = unitType;
988 983
989 /** 984 /**
990 * Whether the document to print is modifiable. 985 * Whether the document to print is modifiable.
991 * @type {boolean} 986 * @private {boolean}
992 * @private
993 */ 987 */
994 this.isDocumentModifiable_ = isDocumentModifiable; 988 this.isDocumentModifiable_ = isDocumentModifiable;
995 989
996 /** 990 /**
997 * Title of the document. 991 * Title of the document.
998 * @type {string} 992 * @private {string}
999 * @private
1000 */ 993 */
1001 this.documentTitle_ = documentTitle; 994 this.documentTitle_ = documentTitle;
1002 995
1003 /** 996 /**
1004 * Whether the document has selection. 997 * Whether the document has selection.
1005 * @type {string} 998 * @private {boolean}
1006 * @private
1007 */ 999 */
1008 this.documentHasSelection_ = documentHasSelection; 1000 this.documentHasSelection_ = documentHasSelection;
1009 1001
1010 /** 1002 /**
1011 * Whether selection only should be printed. 1003 * Whether selection only should be printed.
1012 * @type {string} 1004 * @private {boolean}
1013 * @private
1014 */ 1005 */
1015 this.selectionOnly_ = selectionOnly; 1006 this.selectionOnly_ = selectionOnly;
1016 1007
1017 /** 1008 /**
1018 * ID of the system default destination. 1009 * ID of the system default destination.
1019 * @type {?string} 1010 * @private {?string}
1020 * @private
1021 */ 1011 */
1022 this.systemDefaultDestinationId_ = systemDefaultDestinationId; 1012 this.systemDefaultDestinationId_ = systemDefaultDestinationId;
1023 1013
1024 /** 1014 /**
1025 * Serialized app state. 1015 * Serialized app state.
1026 * @type {?string} 1016 * @private {?string}
1027 * @private
1028 */ 1017 */
1029 this.serializedAppStateStr_ = serializedAppStateStr; 1018 this.serializedAppStateStr_ = serializedAppStateStr;
1030 1019
1031 /** 1020 /**
1032 * Serialized default destination selection rules. 1021 * Serialized default destination selection rules.
1033 * @type {?string} 1022 * @private {?string}
1034 * @private
1035 */ 1023 */
1036 this.serializedDefaultDestinationSelectionRulesStr_ = 1024 this.serializedDefaultDestinationSelectionRulesStr_ =
1037 serializedDefaultDestinationSelectionRulesStr; 1025 serializedDefaultDestinationSelectionRulesStr;
1038 }; 1026 }
1039 1027
1040 NativeInitialSettings.prototype = { 1028 NativeInitialSettings.prototype = {
1041 /** 1029 /**
1042 * @return {boolean} Whether the print preview should be in auto-print mode. 1030 * @return {boolean} Whether the print preview should be in auto-print mode.
1043 */ 1031 */
1044 get isInKioskAutoPrintMode() { 1032 get isInKioskAutoPrintMode() {
1045 return this.isInKioskAutoPrintMode_; 1033 return this.isInKioskAutoPrintMode_;
1046 }, 1034 },
1047 1035
1048 /** 1036 /**
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 return this.serializedDefaultDestinationSelectionRulesStr_; 1094 return this.serializedDefaultDestinationSelectionRulesStr_;
1107 } 1095 }
1108 }; 1096 };
1109 1097
1110 // Export 1098 // Export
1111 return { 1099 return {
1112 NativeInitialSettings: NativeInitialSettings, 1100 NativeInitialSettings: NativeInitialSettings,
1113 NativeLayer: NativeLayer 1101 NativeLayer: NativeLayer
1114 }; 1102 };
1115 }); 1103 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/print_preview/metrics.js ('k') | chrome/browser/resources/print_preview/preview_generator.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698