#include "printing/print_settings.h"
#include <tuple>
#include "base/atomic_sequence_num.h"
#include "base/notreached.h"
#include "build/build_config.h"
#include "printing/buildflags/buildflags.h"
#include "printing/units.h"
#if BUILDFLAG(USE_CUPS)
#include "printing/print_job_constants_cups.h"
#endif
#if BUILDFLAG(USE_CUPS_IPP)
#include <cups/cups.h>
#endif
#if BUILDFLAG(IS_WIN)
#include "printing/mojom/print.mojom.h"
#endif
namespace printing {
mojom::ColorModel ColorModeToColorModel(int color_mode) { … }
#if BUILDFLAG(USE_CUPS)
void GetColorModelForModel(mojom::ColorModel color_model,
std::string* color_setting_name,
std::string* color_value) { … }
#endif
#if BUILDFLAG(USE_CUPS_IPP)
std::string GetIppColorModelForModel(mojom::ColorModel color_model) { … }
#endif
std::optional<bool> IsColorModelSelected(mojom::ColorModel color_model) { … }
bool PrintSettings::RequestedMedia::operator==(
const PrintSettings::RequestedMedia& other) const { … }
static base::AtomicSequenceNumber cookie_seq;
PrintSettings::PrintSettings() { … }
PrintSettings::PrintSettings(const PrintSettings& settings) { … }
PrintSettings& PrintSettings::operator=(const PrintSettings& settings) { … }
PrintSettings::~PrintSettings() = default;
bool PrintSettings::operator==(const PrintSettings& other) const { … }
void PrintSettings::Clear() { … }
void PrintSettings::SetPrinterPrintableArea(
const gfx::Size& physical_size_device_units,
const gfx::Rect& printable_area_device_units,
bool landscape_needs_flip) { … }
#if BUILDFLAG(IS_WIN)
void PrintSettings::UpdatePrinterPrintableArea(
const gfx::Rect& printable_area_um) {
float scale = static_cast<float>(device_units_per_inch()) / kMicronsPerInch;
gfx::Rect printable_area_device_units =
gfx::ScaleToRoundedRect(printable_area_um, scale);
gfx::Rect physical_size_rect(page_setup_device_units_.physical_size());
if (printable_area_device_units.IsEmpty() ||
!physical_size_rect.Contains(printable_area_device_units)) {
printable_area_device_units = physical_size_rect;
}
page_setup_device_units_.Init(page_setup_device_units_.physical_size(),
printable_area_device_units,
page_setup_device_units_.text_height());
}
#endif
void PrintSettings::SetCustomMargins(
const PageMargins& requested_margins_in_points) { … }
int PrintSettings::NewCookie() { … }
int PrintSettings::NewInvalidCookie() { … }
void PrintSettings::SetOrientation(bool landscape) { … }
}