[go: nahoru, domu]

blob: bddd437bb19f32cec1ee4ab19ffe90490d63b00d [file] [log] [blame]
Avi Drissmandb497b32022-09-15 19:47:281// Copyright 2012 The Chromium Authors
license.botbf09a502008-08-24 00:55:552// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
initial.commit09911bf2008-07-26 23:55:294
sverrir@google.com8ff1d422009-07-07 21:31:395#ifndef PRINTING_PRINT_SETTINGS_H_
6#define PRINTING_PRINT_SETTINGS_H_
initial.commit09911bf2008-07-26 23:55:297
rbpotter116c2e12017-04-04 19:21:288#include <algorithm>
thestig@chromium.orgdcd1e8862011-08-09 06:06:589#include <string>
Sparik Hayrapetyan48216b32022-12-16 16:07:2610#include <utility>
11#include <vector>
thestig@chromium.orgdcd1e8862011-08-09 06:06:5812
Arthur Sonzogni59ac8222023-11-10 09:46:5413#include <optional>
Alan Screen9347cae2021-04-27 18:11:2414#include "base/component_export.h"
Daniel Hosseinianc3db7f4c2020-06-25 02:09:5215#include "build/build_config.h"
Andrew Rayskiy16f8cab2022-12-15 16:28:3316#include "printing/buildflags/buildflags.h"
Julie Jeongeun Kime454f2602020-04-30 05:20:0717#include "printing/mojom/print.mojom.h"
sverrir@google.com8ff1d422009-07-07 21:31:3918#include "printing/page_range.h"
19#include "printing/page_setup.h"
vandebo@chromium.org1c23b4e2011-10-15 22:30:4820#include "printing/print_job_constants.h"
tfarina3b0452d2014-12-31 15:20:0921#include "ui/gfx/geometry/rect.h"
rbpotter213a4f72017-12-22 22:58:0922#include "ui/gfx/geometry/size.h"
initial.commit09911bf2008-07-26 23:55:2923
Alan Screen2750f09052023-09-01 22:32:3324#if BUILDFLAG(ENABLE_OOP_PRINTING_NO_OOP_BASIC_PRINT_DIALOG)
25#include "base/values.h"
26#endif
27
Xiaohan Wange3d00dd62022-01-08 02:33:2828#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
Vladislav Kuzkokovd4e4ff32019-09-13 11:55:5629#include <map>
30
31#include "base/values.h"
Xiaohan Wange3d00dd62022-01-08 02:33:2832#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
Vladislav Kuzkokovd4e4ff32019-09-13 11:55:5633
Gavin Williamsabc0a7d2023-02-22 20:34:0334#if BUILDFLAG(IS_CHROMEOS)
35#include "chromeos/crosapi/mojom/local_printer.mojom.h"
36#endif // BUILDFLAG(IS_CHROMEOS)
37
initial.commit09911bf2008-07-26 23:55:2938namespace printing {
39
Alan Screen2750f09052023-09-01 22:32:3340#if BUILDFLAG(ENABLE_OOP_PRINTING_NO_OOP_BASIC_PRINT_DIALOG)
41
42#if BUILDFLAG(IS_MAC)
43inline constexpr char kMacSystemPrintDialogDataDestinationType[] =
44 "destination_type";
45inline constexpr char kMacSystemPrintDialogDataDestinationFormat[] =
46 "destination_format";
47inline constexpr char kMacSystemPrintDialogDataDestinationLocation[] =
48 "destination_location";
49inline constexpr char kMacSystemPrintDialogDataPageFormat[] = "page_format";
50inline constexpr char kMacSystemPrintDialogDataPrintSettings[] =
51 "print_settings";
52#endif // BUILDFLAG(IS_MAC)
53
54#if BUILDFLAG(IS_LINUX)
55inline constexpr char kLinuxSystemPrintDialogDataPrinter[] = "printer_name";
56inline constexpr char kLinuxSystemPrintDialogDataPrintSettings[] =
57 "print_settings";
58inline constexpr char kLinuxSystemPrintDialogDataPageSetup[] = "page_setup";
59#endif // BUILDFLAG(IS_LINUX)
60
61#endif // BUILDFLAG(ENABLE_OOP_PRINTING_NO_OOP_BASIC_PRINT_DIALOG)
62
Daniel Hosseinian3553e272021-04-24 00:51:1863// Convert from `color_mode` into a `color_model`. An invalid `color_mode`
64// will give a result of `mojom::ColorModel::kUnknownColorModel`.
Alan Screen9347cae2021-04-27 18:11:2465COMPONENT_EXPORT(PRINTING)
66mojom::ColorModel ColorModeToColorModel(int color_mode);
Alan Screen558045a2020-08-28 23:18:5867
Daniel Hosseinian3553e272021-04-24 00:51:1868// Returns true if `color_model` is color and false if it is B&W. Callers
69// are not supposed to pass in `mojom::ColorModel::kUnknownColorModel`, but
Arthur Sonzogni59ac8222023-11-10 09:46:5470// if they do then the result will be std::nullopt.
Alan Screen9347cae2021-04-27 18:11:2471COMPONENT_EXPORT(PRINTING)
Arthur Sonzogni59ac8222023-11-10 09:46:5472std::optional<bool> IsColorModelSelected(mojom::ColorModel color_model);
kmadhusu@chromium.org63313ae2011-10-13 00:40:3973
Andrew Rayskiy16f8cab2022-12-15 16:28:3374#if BUILDFLAG(USE_CUPS)
Daniel Hosseinian3553e272021-04-24 00:51:1875// Get the color model setting name and value for the `color_model`.
Alan Screen9347cae2021-04-27 18:11:2476COMPONENT_EXPORT(PRINTING)
77void GetColorModelForModel(mojom::ColorModel color_model,
78 std::string* color_setting_name,
79 std::string* color_value);
Lei Zhang04f9ea32023-07-08 01:48:0580#endif // BUILDFLAG(USE_CUPS)
Daniel Hosseinian0f7cafd2020-07-18 01:38:0081
Lei Zhang04f9ea32023-07-08 01:48:0582#if BUILDFLAG(USE_CUPS_IPP)
Daniel Hosseinian3553e272021-04-24 00:51:1883// Convert from `color_model` to a print-color-mode value from PWG 5100.13.
Alan Screen9347cae2021-04-27 18:11:2484COMPONENT_EXPORT(PRINTING)
85std::string GetIppColorModelForModel(mojom::ColorModel color_model);
Lei Zhang04f9ea32023-07-08 01:48:0586#endif // BUILDFLAG(USE_CUPS_IPP)
kmadhusu@chromium.org63313ae2011-10-13 00:40:3987
Alan Screen9347cae2021-04-27 18:11:2488class COMPONENT_EXPORT(PRINTING) PrintSettings {
initial.commit09911bf2008-07-26 23:55:2989 public:
alekseys@chromium.org72ddef92014-06-12 08:08:0690 // Media properties requested by the user. Default instance represents
91 // default media selection.
92 struct RequestedMedia {
Alan Screenb411fe62023-02-16 18:53:2093 bool operator==(const RequestedMedia& other) const;
94 bool IsDefault() const {
95 return size_microns.IsEmpty() && vendor_id.empty();
96 }
97
alekseys@chromium.org72ddef92014-06-12 08:08:0698 // Size of the media, in microns.
99 gfx::Size size_microns;
100 // Platform specific id to map it back to the particular media.
101 std::string vendor_id;
alekseys@chromium.org72ddef92014-06-12 08:08:06102 };
103
Xiaohan Wange3d00dd62022-01-08 02:33:28104#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
Vladislav Kuzkokovd4e4ff32019-09-13 11:55:56105 using AdvancedSettings = std::map<std::string, base::Value>;
Xiaohan Wange3d00dd62022-01-08 02:33:28106#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
Vladislav Kuzkokovd4e4ff32019-09-13 11:55:56107
initial.commit09911bf2008-07-26 23:55:29108 PrintSettings();
Alan Screen2fc197d2021-08-25 00:47:09109 PrintSettings(const PrintSettings&);
110 PrintSettings& operator=(const PrintSettings&);
erg@google.com20f0487a2010-09-30 20:06:30111 ~PrintSettings();
initial.commit09911bf2008-07-26 23:55:29112
Alan Screenb411fe62023-02-16 18:53:20113 bool operator==(const PrintSettings& other) const;
114
Vladislav Kuzkokov56e6bbbd2019-08-21 18:48:18115 // Reinitialize the settings to the default values.
116 void Clear();
117
vandebo@chromium.orgb076a082011-10-20 01:26:32118 void SetCustomMargins(const PageMargins& requested_margins_in_points);
vitalybuka@chromium.orgc95198b2014-06-12 16:56:55119 const PageMargins& requested_custom_margins_in_points() const {
120 return requested_custom_margins_in_points_;
121 }
Julie Jeongeun Kimcb00d1ab2020-08-14 07:43:32122 void set_margin_type(mojom::MarginType margin_type) {
123 margin_type_ = margin_type;
124 }
125 mojom::MarginType margin_type() const { return margin_type_; }
vandebo@chromium.org1c23b4e2011-10-15 22:30:48126
vitalybuka@chromium.orge5324b52013-10-29 03:16:37127 // Updates the orientation and flip the page if needed.
128 void SetOrientation(bool landscape);
129 bool landscape() const { return landscape_; }
initial.commit09911bf2008-07-26 23:55:29130
alekseys@chromium.org72ddef92014-06-12 08:08:06131 // Updates user requested media.
132 void set_requested_media(const RequestedMedia& media) {
133 requested_media_ = media;
134 }
135 // Media properties requested by the user. Translated into device media by the
136 // platform specific layers.
Lei Zhang01a1d3c2019-05-21 04:59:10137 const RequestedMedia& requested_media() const { return requested_media_; }
alekseys@chromium.org72ddef92014-06-12 08:08:06138
vitalybuka@chromium.orge5324b52013-10-29 03:16:37139 // Set printer printable area in in device units.
Daniel Hosseinian3553e272021-04-24 00:51:18140 // Some platforms already provide flipped area. Set `landscape_needs_flip`
vitalybuka@chromium.orge5324b52013-10-29 03:16:37141 // to false on those platforms to avoid double flipping.
Vladislav Kuzkokova3f4af8f2017-11-28 15:20:26142 // This method assumes correct DPI is already set.
vitalybuka@chromium.orge5324b52013-10-29 03:16:37143 void SetPrinterPrintableArea(const gfx::Size& physical_size_device_units,
144 const gfx::Rect& printable_area_device_units,
vitalybuka@chromium.orge5324b52013-10-29 03:16:37145 bool landscape_needs_flip);
Alan Screen0bc5a4e2023-04-10 21:15:13146#if BUILDFLAG(IS_WIN)
147 // Update the printer printable area for the current media using the
148 // provided area in microns.
149 void UpdatePrinterPrintableArea(const gfx::Rect& printable_area_um);
150#endif
vitalybuka@chromium.orge5324b52013-10-29 03:16:37151 const PageSetup& page_setup_device_units() const {
152 return page_setup_device_units_;
153 }
Alan Screen2fc197d2021-08-25 00:47:09154 // `set_page_setup_device_units()` intended to be used only for mojom
155 // validation.
156 void set_page_setup_device_units(const PageSetup& page_setup_device_units) {
157 page_setup_device_units_ = page_setup_device_units;
158 }
vitalybuka@chromium.orge5324b52013-10-29 03:16:37159
Jan Wilken Dörrie739ccc212021-03-11 18:13:05160 void set_device_name(const std::u16string& device_name) {
initial.commit09911bf2008-07-26 23:55:29161 device_name_ = device_name;
162 }
Jan Wilken Dörrie739ccc212021-03-11 18:13:05163 const std::u16string& device_name() const { return device_name_; }
vitalybuka@chromium.orge5324b52013-10-29 03:16:37164
Bryan Cainea23cf02023-08-28 19:19:47165 void set_borderless(bool borderless) { borderless_ = borderless; }
166 bool borderless() const { return borderless_; }
167
Bryan Caindeee87d2023-08-10 18:07:54168 void set_media_type(const std::string& media_type) {
169 media_type_ = media_type;
170 }
171 const std::string& media_type() const { return media_type_; }
172
rbpotter213a4f72017-12-22 22:58:09173 void set_dpi(int dpi) { dpi_ = gfx::Size(dpi, dpi); }
rbpotter116c2e12017-04-04 19:21:28174 void set_dpi_xy(int dpi_horizontal, int dpi_vertical) {
rbpotter213a4f72017-12-22 22:58:09175 dpi_ = gfx::Size(dpi_horizontal, dpi_vertical);
rbpotter116c2e12017-04-04 19:21:28176 }
rbpotter213a4f72017-12-22 22:58:09177
178 int dpi() const { return std::max(dpi_.width(), dpi_.height()); }
179 int dpi_horizontal() const { return dpi_.width(); }
180 int dpi_vertical() const { return dpi_.height(); }
rbpottere33e8e622018-01-25 01:10:33181 const gfx::Size& dpi_size() const { return dpi_; }
vitalybuka@chromium.orge5324b52013-10-29 03:16:37182
rbpotter769ffdf2016-10-26 00:53:57183 void set_scale_factor(double scale_factor) { scale_factor_ = scale_factor; }
184 double scale_factor() const { return scale_factor_; }
185
rbpotter0fab356022016-12-28 22:00:23186 void set_rasterize_pdf(bool rasterize_pdf) { rasterize_pdf_ = rasterize_pdf; }
187 bool rasterize_pdf() const { return rasterize_pdf_; }
188
Alan Screendce2e582021-08-12 21:10:47189 void set_rasterize_pdf_dpi(int32_t dpi) { rasterize_pdf_dpi_ = dpi; }
190 int32_t rasterize_pdf_dpi() const { return rasterize_pdf_dpi_; }
191
sanjeevr@chromium.org6ab86ac2010-05-29 07:18:29192 int device_units_per_inch() const {
Xiaohan Wange3d00dd62022-01-08 02:33:28193#if BUILDFLAG(IS_MAC)
Lei Zhangc57fc30f2022-12-07 22:49:41194 return kMacDeviceUnitsPerInch;
Xiaohan Wange3d00dd62022-01-08 02:33:28195#else // BUILDFLAG(IS_MAC)
sanjeevr@chromium.org6ab86ac2010-05-29 07:18:29196 return dpi();
Xiaohan Wange3d00dd62022-01-08 02:33:28197#endif // BUILDFLAG(IS_MAC)
sanjeevr@chromium.org6ab86ac2010-05-29 07:18:29198 }
initial.commit09911bf2008-07-26 23:55:29199
Lei Zhangc57fc30f2022-12-07 22:49:41200 const gfx::Size& device_units_per_inch_size() const {
201#if BUILDFLAG(IS_MAC)
202 static constexpr gfx::Size kSize{kMacDeviceUnitsPerInch,
203 kMacDeviceUnitsPerInch};
204 return kSize;
205#else // BUILDFLAG(IS_MAC)
206 return dpi_size();
207#endif // BUILDFLAG(IS_MAC)
208 }
209
thestige85e6b62016-08-25 00:00:06210 void set_ranges(const PageRanges& ranges) { ranges_ = ranges; }
211 const PageRanges& ranges() const { return ranges_; }
initial.commit09911bf2008-07-26 23:55:29212
vitalybuka@chromium.orge5324b52013-10-29 03:16:37213 void set_selection_only(bool selection_only) {
214 selection_only_ = selection_only;
215 }
216 bool selection_only() const { return selection_only_; }
initial.commit09911bf2008-07-26 23:55:29217
vitalybuka@chromium.orge5324b52013-10-29 03:16:37218 void set_should_print_backgrounds(bool should_print_backgrounds) {
219 should_print_backgrounds_ = should_print_backgrounds;
220 }
221 bool should_print_backgrounds() const { return should_print_backgrounds_; }
initial.commit09911bf2008-07-26 23:55:29222
vitalybuka@chromium.orge5324b52013-10-29 03:16:37223 void set_display_header_footer(bool display_header_footer) {
224 display_header_footer_ = display_header_footer;
225 }
226 bool display_header_footer() const { return display_header_footer_; }
initial.commit09911bf2008-07-26 23:55:29227
Jan Wilken Dörrie739ccc212021-03-11 18:13:05228 void set_title(const std::u16string& title) { title_ = title; }
229 const std::u16string& title() const { return title_; }
sverrir@google.comc8ad40c2009-06-08 17:05:21230
Jan Wilken Dörrie739ccc212021-03-11 18:13:05231 void set_url(const std::u16string& url) { url_ = url; }
232 const std::u16string& url() const { return url_; }
vitalybuka@chromium.orge5324b52013-10-29 03:16:37233
234 void set_collate(bool collate) { collate_ = collate; }
235 bool collate() const { return collate_; }
236
Alan Screen3fb63bf2020-08-19 00:11:23237 void set_color(mojom::ColorModel color) { color_ = color; }
238 mojom::ColorModel color() const { return color_; }
vitalybuka@chromium.orge5324b52013-10-29 03:16:37239
240 void set_copies(int copies) { copies_ = copies; }
241 int copies() const { return copies_; }
242
Julie Jeongeun Kime454f2602020-04-30 05:20:07243 void set_duplex_mode(mojom::DuplexMode duplex_mode) {
244 duplex_mode_ = duplex_mode;
245 }
246 mojom::DuplexMode duplex_mode() const { return duplex_mode_; }
vitalybuka@chromium.orge5324b52013-10-29 03:16:37247
Xiaohan Wange3d00dd62022-01-08 02:33:28248#if BUILDFLAG(IS_WIN)
Alan Screenee634e72021-07-02 20:08:51249 void set_printer_language_type(mojom::PrinterLanguageType type) {
250 printer_language_type_ = type;
rbpotter0437a1712017-07-14 21:23:24251 }
Alan Screen2fc197d2021-08-25 00:47:09252 mojom::PrinterLanguageType printer_language_type() const {
253 return printer_language_type_;
254 }
Alan Screenee634e72021-07-02 20:08:51255 bool printer_language_is_textonly() const {
256 return printer_language_type_ == mojom::PrinterLanguageType::kTextOnly;
rbpotter58bc882e2017-02-01 03:44:24257 }
Alan Screenee634e72021-07-02 20:08:51258 bool printer_language_is_xps() const {
259 return printer_language_type_ == mojom::PrinterLanguageType::kXps;
260 }
261 bool printer_language_is_ps2() const {
262 return printer_language_type_ ==
263 mojom::PrinterLanguageType::kPostscriptLevel2;
264 }
265 bool printer_language_is_ps3() const {
266 return printer_language_type_ ==
267 mojom::PrinterLanguageType::kPostscriptLevel3;
rbpotter58bc882e2017-02-01 03:44:24268 }
thestige85e6b62016-08-25 00:00:06269#endif
270
Wei Li02720a42017-10-25 22:06:48271 void set_is_modifiable(bool is_modifiable) { is_modifiable_ = is_modifiable; }
272 bool is_modifiable() const { return is_modifiable_; }
273
xlou6bd7c2d2018-07-10 01:35:40274 int pages_per_sheet() const { return pages_per_sheet_; }
275 void set_pages_per_sheet(int pages_per_sheet) {
276 pages_per_sheet_ = pages_per_sheet;
xlou194207562018-04-26 23:42:44277 }
278
Xiaohan Wange3d00dd62022-01-08 02:33:28279#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
Daniel Hosseinianc3db7f4c2020-06-25 02:09:52280 AdvancedSettings& advanced_settings() { return advanced_settings_; }
281 const AdvancedSettings& advanced_settings() const {
282 return advanced_settings_;
283 }
Xiaohan Wange3d00dd62022-01-08 02:33:28284#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
Daniel Hosseinianc3db7f4c2020-06-25 02:09:52285
Xiaohan Wange3d00dd62022-01-08 02:33:28286#if BUILDFLAG(IS_CHROMEOS)
Vladislav Kuzkokov48b15002019-01-30 17:13:35287 void set_send_user_info(bool send_user_info) {
288 send_user_info_ = send_user_info;
289 }
290 bool send_user_info() const { return send_user_info_; }
291
292 void set_username(const std::string& username) { username_ = username; }
293 const std::string& username() const { return username_; }
Nikita Podguzovc1bf3f82019-03-19 15:23:23294
Piotr Pawliczeka7b35342022-11-01 18:18:50295 void set_oauth_token(const std::string& oauth_token) {
296 oauth_token_ = oauth_token;
297 }
298 const std::string& oauth_token() const { return oauth_token_; }
299
Nikita Podguzovc1bf3f82019-03-19 15:23:23300 void set_pin_value(const std::string& pin_value) { pin_value_ = pin_value; }
301 const std::string& pin_value() const { return pin_value_; }
Sparik Hayrapetyan48216b32022-12-16 16:07:26302
303 void set_client_infos(std::vector<mojom::IppClientInfo> client_infos) {
304 client_infos_ = std::move(client_infos);
305 }
306 const std::vector<mojom::IppClientInfo>& client_infos() const {
307 return client_infos_;
308 }
Gavin Williams9324ed692023-02-15 04:19:31309
310 void set_printer_manually_selected(bool printer_manually_selected) {
311 printer_manually_selected_ = printer_manually_selected;
312 }
313 bool printer_manually_selected() const { return printer_manually_selected_; }
Gavin Williamsabc0a7d2023-02-22 20:34:03314
315 void set_printer_status_reason(
316 crosapi::mojom::StatusReason::Reason printer_status_reason) {
317 printer_status_reason_ = printer_status_reason;
318 }
Arthur Sonzogni59ac8222023-11-10 09:46:54319 std::optional<crosapi::mojom::StatusReason::Reason> printer_status_reason()
Gavin Williamsabc0a7d2023-02-22 20:34:03320 const {
321 return printer_status_reason_;
322 }
Xiaohan Wange3d00dd62022-01-08 02:33:28323#endif // BUILDFLAG(IS_CHROMEOS)
Vladislav Kuzkokov48b15002019-01-30 17:13:35324
Alan Screen2750f09052023-09-01 22:32:33325#if BUILDFLAG(ENABLE_OOP_PRINTING_NO_OOP_BASIC_PRINT_DIALOG)
326 void set_system_print_dialog_data(base::Value::Dict data) {
327 system_print_dialog_data_ = std::move(data);
328 }
329 const base::Value::Dict& system_print_dialog_data() const {
330 return system_print_dialog_data_;
331 }
332#endif
Alan Screenee634e72021-07-02 20:08:51333 // Cookie generator. It is used to initialize `PrintedDocument` with its
334 // associated `PrintSettings`, to be sure that each generated `PrintedPage`
335 // is correctly associated with its corresponding `PrintedDocument`.
initial.commit09911bf2008-07-26 23:55:29336 static int NewCookie();
337
Lei Zhangeb676822023-06-30 19:11:52338 // Creates an invalid cookie for use in situations where the cookie needs to
339 // be marked as invalid.
340 static int NewInvalidCookie();
341
vitalybuka@chromium.orge5324b52013-10-29 03:16:37342 private:
Lei Zhangc57fc30f2022-12-07 22:49:41343#if BUILDFLAG(IS_MAC)
344 static constexpr int kMacDeviceUnitsPerInch = 72;
345#endif
346
Alan Screenee634e72021-07-02 20:08:51347 // Multi-page printing. Each `PageRange` describes a from-to page combination.
vitalybuka@chromium.orge5324b52013-10-29 03:16:37348 // This permits printing selected pages only.
349 PageRanges ranges_;
350
vitalybuka@chromium.orge5324b52013-10-29 03:16:37351 // Indicates if the user only wants to print the current selection.
Vladislav Kuzkokov56e6bbbd2019-08-21 18:48:18352 bool selection_only_;
vitalybuka@chromium.orge5324b52013-10-29 03:16:37353
354 // Indicates what kind of margins should be applied to the printable area.
Julie Jeongeun Kimcb00d1ab2020-08-14 07:43:32355 mojom::MarginType margin_type_;
thestig@chromium.orgc48bee22011-03-29 02:36:26356
aayushkumar@chromium.org55b23a02011-08-17 23:09:36357 // Strings to be printed as headers and footers if requested by the user.
Jan Wilken Dörrie739ccc212021-03-11 18:13:05358 std::u16string title_;
359 std::u16string url_;
aayushkumar@chromium.org55b23a02011-08-17 23:09:36360
361 // True if the user wants headers and footers to be displayed.
Vladislav Kuzkokov56e6bbbd2019-08-21 18:48:18362 bool display_header_footer_;
aayushkumar@chromium.org55b23a02011-08-17 23:09:36363
rltoscano@chromium.org19d1c2d2013-01-14 00:59:46364 // True if the user wants to print CSS backgrounds.
Vladislav Kuzkokov56e6bbbd2019-08-21 18:48:18365 bool should_print_backgrounds_;
rltoscano@chromium.org19d1c2d2013-01-14 00:59:46366
vitalybuka@chromium.orge5324b52013-10-29 03:16:37367 // True if the user wants to print with collate.
Vladislav Kuzkokov56e6bbbd2019-08-21 18:48:18368 bool collate_;
vitalybuka@chromium.orge5324b52013-10-29 03:16:37369
Alan Screen3fb63bf2020-08-19 00:11:23370 // Color model type for the printer to use.
371 mojom::ColorModel color_;
vitalybuka@chromium.orge5324b52013-10-29 03:16:37372
373 // Number of copies user wants to print.
Vladislav Kuzkokov56e6bbbd2019-08-21 18:48:18374 int copies_;
vitalybuka@chromium.orge5324b52013-10-29 03:16:37375
376 // Duplex type user wants to use.
Julie Jeongeun Kime454f2602020-04-30 05:20:07377 mojom::DuplexMode duplex_mode_;
initial.commit09911bf2008-07-26 23:55:29378
initial.commit09911bf2008-07-26 23:55:29379 // Printer device name as opened by the OS.
Jan Wilken Dörrie739ccc212021-03-11 18:13:05380 std::u16string device_name_;
initial.commit09911bf2008-07-26 23:55:29381
Alan Screen2750f09052023-09-01 22:32:33382#if BUILDFLAG(ENABLE_OOP_PRINTING_NO_OOP_BASIC_PRINT_DIALOG)
383 // Platform-specific print settings captured from a system print dialog.
384 // The settings are captured in the browser process for transmission to
385 // the Print Backend service for OOP printing.
386 base::Value::Dict system_print_dialog_data_;
387#endif
388
alekseys@chromium.org72ddef92014-06-12 08:08:06389 // Media requested by the user.
390 RequestedMedia requested_media_;
391
sanjeevr@chromium.org6ab86ac2010-05-29 07:18:29392 // Page setup in device units.
393 PageSetup page_setup_device_units_;
initial.commit09911bf2008-07-26 23:55:29394
Bryan Cainea23cf02023-08-28 19:19:47395 // Whether the user has requested borderless (zero margin) printing.
396 bool borderless_;
397
Bryan Caindeee87d2023-08-10 18:07:54398 // Media type requested by the user.
399 std::string media_type_;
400
rbpotter116c2e12017-04-04 19:21:28401 // Printer's device effective dots per inch in both axes. The two values will
402 // generally be identical. However, on Windows, there are a few rare printers
403 // that support resolutions with different DPI in different dimensions.
rbpotter213a4f72017-12-22 22:58:09404 gfx::Size dpi_;
initial.commit09911bf2008-07-26 23:55:29405
rbpotter769ffdf2016-10-26 00:53:57406 // Scale factor
Vladislav Kuzkokov56e6bbbd2019-08-21 18:48:18407 double scale_factor_;
rbpotter769ffdf2016-10-26 00:53:57408
rbpotter0fab356022016-12-28 22:00:23409 // True if PDF should be printed as a raster PDF
Vladislav Kuzkokov56e6bbbd2019-08-21 18:48:18410 bool rasterize_pdf_;
rbpotter0fab356022016-12-28 22:00:23411
Alan Screendce2e582021-08-12 21:10:47412 // The DPI which overrides the calculated value normally used when
413 // rasterizing a PDF. A non-positive value would be an invalid choice of a
414 // DPI and indicates no override.
415 int32_t rasterize_pdf_dpi_;
416
initial.commit09911bf2008-07-26 23:55:29417 // Is the orientation landscape or portrait.
Vladislav Kuzkokov56e6bbbd2019-08-21 18:48:18418 bool landscape_;
senorblanco@chromium.orgb2b0fce2011-01-12 16:34:40419
Xiaohan Wange3d00dd62022-01-08 02:33:28420#if BUILDFLAG(IS_WIN)
Alan Screenee634e72021-07-02 20:08:51421 mojom::PrinterLanguageType printer_language_type_;
thestige85e6b62016-08-25 00:00:06422#endif
423
Vladislav Kuzkokov56e6bbbd2019-08-21 18:48:18424 bool is_modifiable_;
Wei Li02720a42017-10-25 22:06:48425
vandebo@chromium.orgb076a082011-10-20 01:26:32426 // If margin type is custom, this is what was requested.
427 PageMargins requested_custom_margins_in_points_;
xlou194207562018-04-26 23:42:44428
429 // Number of pages per sheet.
Vladislav Kuzkokov56e6bbbd2019-08-21 18:48:18430 int pages_per_sheet_;
Vladislav Kuzkokov48b15002019-01-30 17:13:35431
Xiaohan Wange3d00dd62022-01-08 02:33:28432#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
Daniel Hosseinianc3db7f4c2020-06-25 02:09:52433 // Advanced settings.
434 AdvancedSettings advanced_settings_;
Xiaohan Wange3d00dd62022-01-08 02:33:28435#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
Daniel Hosseinianc3db7f4c2020-06-25 02:09:52436
Xiaohan Wange3d00dd62022-01-08 02:33:28437#if BUILDFLAG(IS_CHROMEOS)
Vladislav Kuzkokov48b15002019-01-30 17:13:35438 // Whether to send user info.
Vladislav Kuzkokov56e6bbbd2019-08-21 18:48:18439 bool send_user_info_;
Vladislav Kuzkokov48b15002019-01-30 17:13:35440
441 // Username if it's required by the printer.
442 std::string username_;
Nikita Podguzovc1bf3f82019-03-19 15:23:23443
Piotr Pawliczeka7b35342022-11-01 18:18:50444 // OAuth access token if it's required by the printer.
445 std::string oauth_token_;
446
Nikita Podguzovc1bf3f82019-03-19 15:23:23447 // PIN code entered by the user.
448 std::string pin_value_;
Sparik Hayrapetyan48216b32022-12-16 16:07:26449
450 // Value of the 'client-info' that will be sent to the printer.
451 // Should only be set for printers that support 'client-info'.
452 std::vector<mojom::IppClientInfo> client_infos_;
Gavin Williams9324ed692023-02-15 04:19:31453
454 // True if the user selects to print to a different printer than the original
455 // destination shown when Print Preview opens.
456 bool printer_manually_selected_;
Gavin Williamsabc0a7d2023-02-22 20:34:03457
458 // The printer status reason shown for the selected printer at the time print
459 // is requested. Only local CrOS printers set printer statuses.
Arthur Sonzogni59ac8222023-11-10 09:46:54460 std::optional<crosapi::mojom::StatusReason::Reason> printer_status_reason_;
Sparik Hayrapetyan48216b32022-12-16 16:07:26461#endif // BUILDFLAG(IS_CHROMEOS)
initial.commit09911bf2008-07-26 23:55:29462};
463
464} // namespace printing
465
sverrir@google.com8ff1d422009-07-07 21:31:39466#endif // PRINTING_PRINT_SETTINGS_H_