chromium/printing/print_settings.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#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  // BUILDFLAG(USE_CUPS)

#if BUILDFLAG(USE_CUPS_IPP)
#include <cups/cups.h>
#endif  // BUILDFLAG(USE_CUPS_IPP)

#if BUILDFLAG(IS_WIN)
#include "printing/mojom/print.mojom.h"
#endif  // BUILDFLAG(IS_WIN)

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  // BUILDFLAG(USE_CUPS)

#if BUILDFLAG(USE_CUPS_IPP)
std::string GetIppColorModelForModel(mojom::ColorModel color_model) {}
#endif  // BUILDFLAG(USE_CUPS_IPP)

std::optional<bool> IsColorModelSelected(mojom::ColorModel color_model) {}

bool PrintSettings::RequestedMedia::operator==(
    const PrintSettings::RequestedMedia& other) const {}

// Global SequenceNumber used for generating unique cookie values.
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) {
  // Scale the page size and printable area to device units.
  // Blink doesn't support different dpi settings in X and Y axis. Because of
  // this, printers with non-square pixels still scale page size and printable
  // area using device_units_per_inch() instead of their respective dimensions
  // in device_units_per_inch_size().
  float scale = static_cast<float>(device_units_per_inch()) / kMicronsPerInch;
  gfx::Rect printable_area_device_units =
      gfx::ScaleToRoundedRect(printable_area_um, scale);

  // Protect against misbehaving drivers.  We have observed some drivers return
  // incorrect values compared to page size.  E.g., HP Business Inkjet 2300 PS.
  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)) {
    // Invalid printable area!  Default to paper size.
    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) {}

// static
int PrintSettings::NewCookie() {}

// static
int PrintSettings::NewInvalidCookie() {}

void PrintSettings::SetOrientation(bool landscape) {}

}  // namespace printing