Avi Drissman | db497b3 | 2022-09-15 19:47:28 | [diff] [blame] | 1 | // Copyright 2012 The Chromium Authors |
thestig@chromium.org | c48bee2 | 2011-03-29 02:36:26 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "printing/print_job_constants.h" |
| 6 | |
Julie Jeongeun Kim | fbf3f18 | 2020-09-16 02:22:34 | [diff] [blame] | 7 | #include <limits> |
| 8 | |
Piotr Pawliczek | a7b3534 | 2022-11-01 18:18:50 | [diff] [blame] | 9 | #include "build/build_config.h" |
| 10 | |
thestig@chromium.org | c48bee2 | 2011-03-29 02:36:26 | [diff] [blame] | 11 | namespace printing { |
| 12 | |
dpapad@chromium.org | 718af82 | 2011-08-12 22:11:33 | [diff] [blame] | 13 | // True if this is the first preview request. |
| 14 | const char kIsFirstRequest[] = "isFirstRequest"; |
| 15 | |
dpapad@chromium.org | a885135 | 2011-07-13 20:16:25 | [diff] [blame] | 16 | // Unique ID sent along every preview request. |
| 17 | const char kPreviewRequestID[] = "requestID"; |
| 18 | |
thestig@chromium.org | ff90674 | 2011-08-23 05:04:46 | [diff] [blame] | 19 | // Unique ID to identify a print preview UI. |
thestig@chromium.org | 116d096 | 2012-08-24 23:22:28 | [diff] [blame] | 20 | const char kPreviewUIID[] = "previewUIID"; |
thestig@chromium.org | ff90674 | 2011-08-23 05:04:46 | [diff] [blame] | 21 | |
Bryan Cain | ea23cf0 | 2023-08-28 19:19:47 | [diff] [blame] | 22 | // If true, tell the printer to print without margins. |
| 23 | const char kSettingBorderless[] = "borderless"; |
| 24 | |
noamsml@chromium.org | 833cac8 | 2014-03-22 04:58:41 | [diff] [blame] | 25 | // Capabilities option. Contains the capabilities in CDD format. |
| 26 | const char kSettingCapabilities[] = "capabilities"; |
| 27 | |
kmadhusu@chromium.org | c97e5e8 | 2011-04-05 18:50:23 | [diff] [blame] | 28 | // Print job setting 'collate'. |
| 29 | const char kSettingCollate[] = "collate"; |
| 30 | |
Vladislav Kuzkokov | 48b1500 | 2019-01-30 17:13:35 | [diff] [blame] | 31 | // Print out color. Value is an int from ColorModel enum. |
thestig@chromium.org | c48bee2 | 2011-03-29 02:36:26 | [diff] [blame] | 32 | const char kSettingColor[] = "color"; |
| 33 | |
abodenha@chromium.org | 0209b44 | 2012-07-18 00:38:05 | [diff] [blame] | 34 | // Default to color on or not. |
| 35 | const char kSettingSetColorAsDefault[] = "setColorAsDefault"; |
| 36 | |
aayushkumar@chromium.org | 7a9b03e3 | 2011-08-23 19:56:18 | [diff] [blame] | 37 | // Key that specifies the height of the content area of the page. |
| 38 | const char kSettingContentHeight[] = "contentHeight"; |
| 39 | |
| 40 | // Key that specifies the width of the content area of the page. |
| 41 | const char kSettingContentWidth[] = "contentWidth"; |
| 42 | |
kmadhusu@chromium.org | c97e5e8 | 2011-04-05 18:50:23 | [diff] [blame] | 43 | // Number of copies. |
| 44 | const char kSettingCopies[] = "copies"; |
| 45 | |
kmadhusu@chromium.org | 987e51f9 | 2011-05-04 21:10:15 | [diff] [blame] | 46 | // Device name: Unique printer identifier. |
| 47 | const char kSettingDeviceName[] = "deviceName"; |
| 48 | |
n.bansal | 2604a97 | 2014-12-09 12:26:47 | [diff] [blame] | 49 | // Option to disable scaling. True if scaling is disabled else false. |
| 50 | const char kSettingDisableScaling[] = "disableScaling"; |
| 51 | |
rbpotter | 1e10f43 | 2018-08-18 03:01:29 | [diff] [blame] | 52 | // Default DPI |
| 53 | const char kSettingDpiDefault[] = "dpiDefault"; |
| 54 | |
rbpotter | 116c2e1 | 2017-04-04 19:21:28 | [diff] [blame] | 55 | // Horizontal DPI |
| 56 | const char kSettingDpiHorizontal[] = "dpiHorizontal"; |
| 57 | |
| 58 | // Vertical DPI |
| 59 | const char kSettingDpiVertical[] = "dpiVertical"; |
| 60 | |
Vladislav Kuzkokov | 48b1500 | 2019-01-30 17:13:35 | [diff] [blame] | 61 | // Print job duplex mode. Value is an int from DuplexMode enum. |
kmadhusu@chromium.org | 826e63a16 | 2011-04-20 18:00:45 | [diff] [blame] | 62 | const char kSettingDuplexMode[] = "duplex"; |
| 63 | |
aayushkumar@chromium.org | 55b23a0 | 2011-08-17 23:09:36 | [diff] [blame] | 64 | // Option to print headers and Footers: true if selected, false if not. |
| 65 | const char kSettingHeaderFooterEnabled[] = "headerFooterEnabled"; |
| 66 | |
vandebo@chromium.org | 06bd1866 | 2011-10-07 06:12:40 | [diff] [blame] | 67 | // Interstice or gap between different header footer components. Hardcoded to |
| 68 | // about 0.5cm, match the value in PrintSettings::SetPrinterPrintableArea. |
| 69 | const float kSettingHeaderFooterInterstice = 14.2f; |
aayushkumar@chromium.org | 55b23a0 | 2011-08-17 23:09:36 | [diff] [blame] | 70 | |
| 71 | // Key that specifies the date of the page that will be printed in the headers |
| 72 | // and footers. |
| 73 | const char kSettingHeaderFooterDate[] = "date"; |
| 74 | |
| 75 | // Key that specifies the title of the page that will be printed in the headers |
| 76 | // and footers. |
| 77 | const char kSettingHeaderFooterTitle[] = "title"; |
| 78 | |
| 79 | // Key that specifies the URL of the page that will be printed in the headers |
| 80 | // and footers. |
| 81 | const char kSettingHeaderFooterURL[] = "url"; |
| 82 | |
thestig@chromium.org | c48bee2 | 2011-03-29 02:36:26 | [diff] [blame] | 83 | // Page orientation: true for landscape, false for portrait. |
| 84 | const char kSettingLandscape[] = "landscape"; |
| 85 | |
alekseys@chromium.org | ae98e57 | 2014-05-14 23:52:55 | [diff] [blame] | 86 | // Key that specifies the requested media size. |
| 87 | const char kSettingMediaSize[] = "mediaSize"; |
| 88 | |
| 89 | // Key that specifies the requested media height in microns. |
| 90 | const char kSettingMediaSizeHeightMicrons[] = "height_microns"; |
| 91 | |
| 92 | // Key that specifies the requested media width in microns. |
| 93 | const char kSettingMediaSizeWidthMicrons[] = "width_microns"; |
| 94 | |
Lei Zhang | 48502cb8 | 2022-07-20 22:48:46 | [diff] [blame] | 95 | // Key that specifies the left side of the bounding box for the requested |
| 96 | // media's printable area. |
| 97 | const char kSettingsImageableAreaLeftMicrons[] = "imageable_area_left_microns"; |
| 98 | |
| 99 | // Key that specifies the bottom side of the bounding box for the requested |
| 100 | // media's printable area. |
| 101 | const char kSettingsImageableAreaBottomMicrons[] = |
| 102 | "imageable_area_bottom_microns"; |
| 103 | |
| 104 | // Key that specifies the right side of the bounding box for the requested |
| 105 | // media's printable area. |
| 106 | const char kSettingsImageableAreaRightMicrons[] = |
| 107 | "imageable_area_right_microns"; |
| 108 | |
| 109 | // Key that specifies the top side of the bounding box for the requested |
| 110 | // media's printable area. |
| 111 | const char kSettingsImageableAreaTopMicrons[] = "imageable_area_top_microns"; |
| 112 | |
alekseys@chromium.org | 72ddef9 | 2014-06-12 08:08:06 | [diff] [blame] | 113 | // Key that specifies the requested media platform specific vendor id. |
| 114 | const char kSettingMediaSizeVendorId[] = "vendor_id"; |
| 115 | |
alekseys | d6a8369b | 2014-09-24 23:01:31 | [diff] [blame] | 116 | // Key that specifies whether the requested media is a default one. |
| 117 | const char kSettingMediaSizeIsDefault[] = "is_default"; |
| 118 | |
Bryan Cain | deee87d | 2023-08-10 18:07:54 | [diff] [blame] | 119 | // Key that specifies the requested media type (plain, photo paper, etc.) |
| 120 | const char kSettingMediaType[] = "mediaType"; |
| 121 | |
aayushkumar@chromium.org | 7a9b03e3 | 2011-08-23 19:56:18 | [diff] [blame] | 122 | // Key that specifies the bottom margin of the page. |
| 123 | const char kSettingMarginBottom[] = "marginBottom"; |
| 124 | |
| 125 | // Key that specifies the left margin of the page. |
| 126 | const char kSettingMarginLeft[] = "marginLeft"; |
| 127 | |
| 128 | // Key that specifies the right margin of the page. |
| 129 | const char kSettingMarginRight[] = "marginRight"; |
| 130 | |
| 131 | // Key that specifies the top margin of the page. |
| 132 | const char kSettingMarginTop[] = "marginTop"; |
| 133 | |
vandebo@chromium.org | 6a7fdfd | 2011-10-13 09:05:42 | [diff] [blame] | 134 | // Key that specifies the dictionary of custom margins as set by the user. |
| 135 | const char kSettingMarginsCustom[] = "marginsCustom"; |
| 136 | |
| 137 | // Key that specifies the type of margins to use. Value is an int from the |
| 138 | // MarginType enum. |
| 139 | const char kSettingMarginsType[] = "marginsType"; |
aayushkumar@chromium.org | 7a9b03e3 | 2011-08-23 19:56:18 | [diff] [blame] | 140 | |
vitalybuka@chromium.org | 82b6e0fc | 2013-02-12 01:28:20 | [diff] [blame] | 141 | // Number of pages to print. |
| 142 | const char kSettingPreviewPageCount[] = "pageCount"; |
| 143 | |
thestig@chromium.org | 06cb2388 | 2011-04-23 01:58:22 | [diff] [blame] | 144 | // A page range. |
| 145 | const char kSettingPageRange[] = "pageRange"; |
| 146 | |
| 147 | // The first page of a page range. (1-based) |
| 148 | const char kSettingPageRangeFrom[] = "from"; |
| 149 | |
| 150 | // The last page of a page range. (1-based) |
| 151 | const char kSettingPageRangeTo[] = "to"; |
| 152 | |
vitalybuka@chromium.org | 3c0bcfa | 2013-11-21 22:47:00 | [diff] [blame] | 153 | // Page size of document to print. |
| 154 | const char kSettingPageWidth[] = "pageWidth"; |
| 155 | const char kSettingPageHeight[] = "pageHeight"; |
| 156 | |
Nikita Podguzov | c1bf3f8 | 2019-03-19 15:23:23 | [diff] [blame] | 157 | // PIN code entered by the user. |
| 158 | const char kSettingPinValue[] = "pinValue"; |
| 159 | |
Vladislav Kuzkokov | 4550509 | 2018-08-30 01:30:07 | [diff] [blame] | 160 | // Policies affecting printing destination. |
| 161 | const char kSettingPolicies[] = "policies"; |
| 162 | |
Lei Zhang | d5b46d07 | 2019-09-14 00:11:03 | [diff] [blame] | 163 | // Whether the source page content is modifiable. True for web content. |
| 164 | // i.e. Anything from Blink. False for everything else. e.g. PDF/Flash. |
vandebo@chromium.org | d75a0317e | 2011-10-17 20:20:40 | [diff] [blame] | 165 | const char kSettingPreviewModifiable[] = "previewModifiable"; |
| 166 | |
kmadhusu@chromium.org | 0e77a1d | 2012-03-20 03:10:20 | [diff] [blame] | 167 | // Keys that specifies the printable area details. |
| 168 | const char kSettingPrintableAreaX[] = "printableAreaX"; |
| 169 | const char kSettingPrintableAreaY[] = "printableAreaY"; |
| 170 | const char kSettingPrintableAreaWidth[] = "printableAreaWidth"; |
| 171 | const char kSettingPrintableAreaHeight[] = "printableAreaHeight"; |
| 172 | |
vitalybuka@chromium.org | 6df7b5a | 2014-03-29 17:39:47 | [diff] [blame] | 173 | // Printer description. |
| 174 | const char kSettingPrinterDescription[] = "printerDescription"; |
| 175 | |
Lei Zhang | 211c8d129 | 2019-10-10 16:23:50 | [diff] [blame] | 176 | // Printer name. |
| 177 | const char kSettingPrinterName[] = "printerName"; |
| 178 | |
vitalybuka@chromium.org | 6df7b5a | 2014-03-29 17:39:47 | [diff] [blame] | 179 | // Additional printer options. |
| 180 | const char kSettingPrinterOptions[] = "printerOptions"; |
| 181 | |
Lei Zhang | 211c8d129 | 2019-10-10 16:23:50 | [diff] [blame] | 182 | // The printer type is an enum PrinterType. |
| 183 | const char kSettingPrinterType[] = "printerType"; |
| 184 | |
rbpotter | 738f3a9b | 2018-12-21 21:20:29 | [diff] [blame] | 185 | // Print to Google Drive option: true if selected, false if not. |
| 186 | const char kSettingPrintToGoogleDrive[] = "printToGoogleDrive"; |
| 187 | |
rbpotter | 769ffdf | 2016-10-26 00:53:57 | [diff] [blame] | 188 | // Scaling factor |
| 189 | const char kSettingScaleFactor[] = "scaleFactor"; |
| 190 | |
Daniel Hosseinian | 7b701257 | 2019-10-14 19:52:05 | [diff] [blame] | 191 | // Scaling type |
| 192 | const char kSettingScalingType[] = "scalingType"; |
| 193 | |
xlou | 0096370 | 2018-05-11 21:23:32 | [diff] [blame] | 194 | // Number of pages per sheet. |
| 195 | const char kSettingPagesPerSheet[] = "pagesPerSheet"; |
| 196 | |
rbpotter | ea6067d | 2017-03-09 22:16:58 | [diff] [blame] | 197 | // Whether to rasterize the PDF for printing. |
rbpotter | 0fab35602 | 2016-12-28 22:00:23 | [diff] [blame] | 198 | const char kSettingRasterizePdf[] = "rasterizePDF"; |
| 199 | |
Alan Screen | dce2e585b | 2021-08-12 21:10:47 | [diff] [blame] | 200 | // The DPI override to use when rasterize the PDF for printing. |
| 201 | const char kSettingRasterizePdfDpi[] = "rasterizePdfDpi"; |
| 202 | |
noamsml@chromium.org | 014a62cb | 2013-11-09 17:23:25 | [diff] [blame] | 203 | // Ticket option. Contains the ticket in CJT format. |
| 204 | const char kSettingTicket[] = "ticket"; |
| 205 | |
Vladislav Kuzkokov | 48b1500 | 2019-01-30 17:13:35 | [diff] [blame] | 206 | // Whether to sent user info to the printer. |
| 207 | const char kSettingSendUserInfo[] = "sendUserInfo"; |
| 208 | |
rltoscano@chromium.org | 19d1c2d | 2013-01-14 00:59:46 | [diff] [blame] | 209 | // Whether to print CSS backgrounds. |
| 210 | const char kSettingShouldPrintBackgrounds[] = "shouldPrintBackgrounds"; |
| 211 | |
vitalybuka@chromium.org | edb363a8 | 2013-01-29 12:11:29 | [diff] [blame] | 212 | // Whether to print selection only. |
| 213 | const char kSettingShouldPrintSelectionOnly[] = "shouldPrintSelectionOnly"; |
| 214 | |
thestig | 9b14c59 | 2016-01-14 19:30:03 | [diff] [blame] | 215 | // Whether to print using the system dialog. |
vitalybuka | 92ab8ce | 2014-08-26 23:41:45 | [diff] [blame] | 216 | const char kSettingShowSystemDialog[] = "showSystemDialog"; |
| 217 | |
Vladislav Kuzkokov | 48b1500 | 2019-01-30 17:13:35 | [diff] [blame] | 218 | // Username to be sent to printer. |
| 219 | const char kSettingUsername[] = "username"; |
| 220 | |
Vladislav Kuzkokov | d4e4ff3 | 2019-09-13 11:55:56 | [diff] [blame] | 221 | // Advanced settings items. |
| 222 | const char kSettingAdvancedSettings[] = "advancedSettings"; |
| 223 | |
thestig@chromium.org | ff90674 | 2011-08-23 05:04:46 | [diff] [blame] | 224 | // Indices used to represent first preview page and complete preview document. |
vandebo@chromium.org | fd0b50340 | 2011-07-26 09:01:33 | [diff] [blame] | 225 | const int FIRST_PAGE_INDEX = 0; |
| 226 | const int COMPLETE_PREVIEW_DOCUMENT_INDEX = -1; |
vandebo@chromium.org | fd0b50340 | 2011-07-26 09:01:33 | [diff] [blame] | 227 | |
vitalybuka@chromium.org | e5324b5 | 2013-10-29 03:16:37 | [diff] [blame] | 228 | // Whether to show PDF in view provided by OS. Implemented for MacOS only. |
rbpotter | 6195808 | 2021-09-22 18:58:20 | [diff] [blame] | 229 | const char kSettingOpenPDFInPreview[] = "openPDFInPreview"; |
kmadhusu@chromium.org | 97c29575 | 2011-11-17 00:44:37 | [diff] [blame] | 230 | |
Julie Jeongeun Kim | fbf3f18 | 2020-09-16 02:22:34 | [diff] [blame] | 231 | const uint32_t kInvalidPageIndex = std::numeric_limits<int>::max(); |
| 232 | const uint32_t kMaxPageCount = std::numeric_limits<int>::max(); |
| 233 | |
Sparik Hayrapetyan | 48216b3 | 2022-12-16 16:07:26 | [diff] [blame] | 234 | #if BUILDFLAG(IS_CHROMEOS) |
| 235 | // If set, contains OAuth token that must be used during communication with the |
| 236 | // printer. |
| 237 | const char kSettingChromeOSAccessOAuthToken[] = "chromeos-access-oauth-token"; |
| 238 | |
| 239 | // These correspond to IPP 'client-info' attribute and member attributes. If |
| 240 | // set, 'client-info' will be sent in the IPP print job. |
| 241 | const char kSettingIppClientInfo[] = "ipp-client-info"; |
| 242 | const char kSettingIppClientName[] = "ipp-client-name"; |
| 243 | const char kSettingIppClientPatches[] = "ipp-client-patches"; |
| 244 | const char kSettingIppClientStringVersion[] = "ipp-client-string-version"; |
| 245 | const char kSettingIppClientType[] = "ipp-client-type"; |
| 246 | const char kSettingIppClientVersion[] = "ipp-client-version"; |
Gavin Williams | 9324ed69 | 2023-02-15 04:19:31 | [diff] [blame] | 247 | |
dpapad | 48010c3 | 2025-04-22 21:22:03 | [diff] [blame] | 248 | // Whether the source page content is from ARC or not. |
| 249 | const char kSettingPreviewIsFromArc[] = "previewIsFromArc"; |
| 250 | |
Gavin Williams | 9324ed69 | 2023-02-15 04:19:31 | [diff] [blame] | 251 | // True if the user selects to print to a different printer than the original |
| 252 | // destination shown when Print Preview opens. |
| 253 | const char kSettingPrinterManuallySelected[] = "printerManuallySelected"; |
Gavin Williams | abc0a7d | 2023-02-22 20:34:03 | [diff] [blame] | 254 | |
| 255 | // The printer status reason shown for the selected printer at the time print |
| 256 | // is requested. Only local CrOS printers set printer statuses. |
| 257 | const char kSettingPrinterStatusReason[] = "printerStatusReason"; |
Sparik Hayrapetyan | 48216b3 | 2022-12-16 16:07:26 | [diff] [blame] | 258 | #endif // BUILDFLAG(IS_CHROMEOS) |
| 259 | |
thestig@chromium.org | c48bee2 | 2011-03-29 02:36:26 | [diff] [blame] | 260 | } // namespace printing |