| OLD | NEW |
| 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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 print_preview.MeasurementSystem.parseNumberFormat( | 474 print_preview.MeasurementSystem.parseNumberFormat( |
| 475 initialSettings['numberFormat']); | 475 initialSettings['numberFormat']); |
| 476 var unitType = print_preview.MeasurementSystem.UnitType.IMPERIAL; | 476 var unitType = print_preview.MeasurementSystem.UnitType.IMPERIAL; |
| 477 if (initialSettings['measurementSystem'] != null) { | 477 if (initialSettings['measurementSystem'] != null) { |
| 478 unitType = initialSettings['measurementSystem']; | 478 unitType = initialSettings['measurementSystem']; |
| 479 } | 479 } |
| 480 | 480 |
| 481 var nativeInitialSettings = new print_preview.NativeInitialSettings( | 481 var nativeInitialSettings = new print_preview.NativeInitialSettings( |
| 482 initialSettings['printAutomaticallyInKioskMode'] || false, | 482 initialSettings['printAutomaticallyInKioskMode'] || false, |
| 483 initialSettings['appKioskMode'] || false, | 483 initialSettings['appKioskMode'] || false, |
| 484 initialSettings['hidePrintWithSystemDialogLink'] || false, | |
| 485 numberFormatSymbols[0] || ',', | 484 numberFormatSymbols[0] || ',', |
| 486 numberFormatSymbols[1] || '.', | 485 numberFormatSymbols[1] || '.', |
| 487 unitType, | 486 unitType, |
| 488 initialSettings['previewModifiable'] || false, | 487 initialSettings['previewModifiable'] || false, |
| 489 initialSettings['initiatorTitle'] || '', | 488 initialSettings['initiatorTitle'] || '', |
| 490 initialSettings['documentHasSelection'] || false, | 489 initialSettings['documentHasSelection'] || false, |
| 491 initialSettings['shouldPrintSelectionOnly'] || false, | 490 initialSettings['shouldPrintSelectionOnly'] || false, |
| 492 initialSettings['printerName'] || null, | 491 initialSettings['printerName'] || null, |
| 493 initialSettings['appState'] || null, | 492 initialSettings['appState'] || null, |
| 494 initialSettings['defaultDestinationSelectionRules'] || null); | 493 initialSettings['defaultDestinationSelectionRules'] || null); |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 * @param {?string} systemDefaultDestinationId ID of the system default | 930 * @param {?string} systemDefaultDestinationId ID of the system default |
| 932 * destination. | 931 * destination. |
| 933 * @param {?string} serializedAppStateStr Serialized app state. | 932 * @param {?string} serializedAppStateStr Serialized app state. |
| 934 * @param {?string} serializedDefaultDestinationSelectionRulesStr Serialized | 933 * @param {?string} serializedDefaultDestinationSelectionRulesStr Serialized |
| 935 * default destination selection rules. | 934 * default destination selection rules. |
| 936 * @constructor | 935 * @constructor |
| 937 */ | 936 */ |
| 938 function NativeInitialSettings( | 937 function NativeInitialSettings( |
| 939 isInKioskAutoPrintMode, | 938 isInKioskAutoPrintMode, |
| 940 isInAppKioskMode, | 939 isInAppKioskMode, |
| 941 hidePrintWithSystemDialogLink, | |
| 942 thousandsDelimeter, | 940 thousandsDelimeter, |
| 943 decimalDelimeter, | 941 decimalDelimeter, |
| 944 unitType, | 942 unitType, |
| 945 isDocumentModifiable, | 943 isDocumentModifiable, |
| 946 documentTitle, | 944 documentTitle, |
| 947 documentHasSelection, | 945 documentHasSelection, |
| 948 selectionOnly, | 946 selectionOnly, |
| 949 systemDefaultDestinationId, | 947 systemDefaultDestinationId, |
| 950 serializedAppStateStr, | 948 serializedAppStateStr, |
| 951 serializedDefaultDestinationSelectionRulesStr) { | 949 serializedDefaultDestinationSelectionRulesStr) { |
| 952 | 950 |
| 953 /** | 951 /** |
| 954 * Whether the print preview should be in auto-print mode. | 952 * Whether the print preview should be in auto-print mode. |
| 955 * @type {boolean} | 953 * @type {boolean} |
| 956 * @private | 954 * @private |
| 957 */ | 955 */ |
| 958 this.isInKioskAutoPrintMode_ = isInKioskAutoPrintMode; | 956 this.isInKioskAutoPrintMode_ = isInKioskAutoPrintMode; |
| 959 | 957 |
| 960 /** | 958 /** |
| 961 * Whether the print preview should switch to App Kiosk mode. | 959 * Whether the print preview should switch to App Kiosk mode. |
| 962 * @type {boolean} | 960 * @type {boolean} |
| 963 * @private | 961 * @private |
| 964 */ | 962 */ |
| 965 this.isInAppKioskMode_ = isInAppKioskMode; | 963 this.isInAppKioskMode_ = isInAppKioskMode; |
| 966 | 964 |
| 967 /** | 965 /** |
| 968 * Whether we should hide the link which shows the system print dialog. | |
| 969 * @type {boolean} | |
| 970 * @private | |
| 971 */ | |
| 972 this.hidePrintWithSystemDialogLink_ = hidePrintWithSystemDialogLink; | |
| 973 | |
| 974 /** | |
| 975 * Character delimeter of thousands digits. | 966 * Character delimeter of thousands digits. |
| 976 * @type {string} | 967 * @type {string} |
| 977 * @private | 968 * @private |
| 978 */ | 969 */ |
| 979 this.thousandsDelimeter_ = thousandsDelimeter; | 970 this.thousandsDelimeter_ = thousandsDelimeter; |
| 980 | 971 |
| 981 /** | 972 /** |
| 982 * Character delimeter of the decimal point. | 973 * Character delimeter of the decimal point. |
| 983 * @type {string} | 974 * @type {string} |
| 984 * @private | 975 * @private |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1052 }, | 1043 }, |
| 1053 | 1044 |
| 1054 /** | 1045 /** |
| 1055 * @return {boolean} Whether the print preview should switch to App Kiosk | 1046 * @return {boolean} Whether the print preview should switch to App Kiosk |
| 1056 * mode. | 1047 * mode. |
| 1057 */ | 1048 */ |
| 1058 get isInAppKioskMode() { | 1049 get isInAppKioskMode() { |
| 1059 return this.isInAppKioskMode_; | 1050 return this.isInAppKioskMode_; |
| 1060 }, | 1051 }, |
| 1061 | 1052 |
| 1062 /** | |
| 1063 * @return {boolean} Whether we should hide the link which shows the | |
| 1064 system print dialog. | |
| 1065 */ | |
| 1066 get hidePrintWithSystemDialogLink() { | |
| 1067 return this.hidePrintWithSystemDialogLink_; | |
| 1068 }, | |
| 1069 | |
| 1070 /** @return {string} Character delimeter of thousands digits. */ | 1053 /** @return {string} Character delimeter of thousands digits. */ |
| 1071 get thousandsDelimeter() { | 1054 get thousandsDelimeter() { |
| 1072 return this.thousandsDelimeter_; | 1055 return this.thousandsDelimeter_; |
| 1073 }, | 1056 }, |
| 1074 | 1057 |
| 1075 /** @return {string} Character delimeter of the decimal point. */ | 1058 /** @return {string} Character delimeter of the decimal point. */ |
| 1076 get decimalDelimeter() { | 1059 get decimalDelimeter() { |
| 1077 return this.decimalDelimeter_; | 1060 return this.decimalDelimeter_; |
| 1078 }, | 1061 }, |
| 1079 | 1062 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1120 return this.serializedDefaultDestinationSelectionRulesStr_; | 1103 return this.serializedDefaultDestinationSelectionRulesStr_; |
| 1121 } | 1104 } |
| 1122 }; | 1105 }; |
| 1123 | 1106 |
| 1124 // Export | 1107 // Export |
| 1125 return { | 1108 return { |
| 1126 NativeInitialSettings: NativeInitialSettings, | 1109 NativeInitialSettings: NativeInitialSettings, |
| 1127 NativeLayer: NativeLayer | 1110 NativeLayer: NativeLayer |
| 1128 }; | 1111 }; |
| 1129 }); | 1112 }); |
| OLD | NEW |