chromium/printing/mojom/printing_context.mojom

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

module printing.mojom;

import "mojo/public/mojom/base/string16.mojom";
import "mojo/public/mojom/base/values.mojom";
import "printing/mojom/print.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";

// Corresponds to `printing::PageMargins` in printing/page_setup.h.
struct PageMargins {
  int32 header;
  int32 footer;
  int32 left;
  int32 right;
  int32 top;
  int32 bottom;
};

// Corresponds to `printing::PageSetup` in printing/page_setup.h.
struct PageSetup {
  gfx.mojom.Size physical_size;
  gfx.mojom.Rect printable_area;
  gfx.mojom.Rect overlay_area;
  gfx.mojom.Rect content_area;
  PageMargins effective_margins;
  PageMargins requested_margins;
  bool forced_margins;
  int32 text_height;
};

// Corresponds to `printing::PrintSettings::RequestedMedia` in
// printing/print_settings.h.
struct RequestedMedia {
  gfx.mojom.Size size_microns;
  string vendor_id;
};

// Corresponds to `printing::PrintSettings` in printing/print_settings.h.
struct PrintSettings {
  array<PageRange> ranges;
  bool selection_only;
  MarginType margin_type;
  mojo_base.mojom.String16 title;
  mojo_base.mojom.String16 url;
  bool display_header_footer;
  bool should_print_backgrounds;
  bool collate;
  ColorModel color;
  int32 copies;
  DuplexMode duplex_mode;
  mojo_base.mojom.String16 device_name;
  RequestedMedia requested_media;
  PageSetup page_setup_device_units;
  bool borderless;
  string media_type;
  gfx.mojom.Size dpi;
  double scale_factor;
  bool rasterize_pdf;
  bool landscape;

  [EnableIf=is_win]
  PrinterLanguageType printer_language_type;

  bool is_modifiable;
  PageMargins requested_custom_margins_in_points;
  int32 pages_per_sheet;

  [EnableIf=is_linux_or_chromeos]
  map<string, mojo_base.mojom.Value> advanced_settings;

  [EnableIf=is_chromeos]
  bool send_user_info;
  [EnableIf=is_chromeos]
  string username;
  [EnableIf=is_chromeos]
  string pin_value;

  [EnableIf=enable_oop_printing_no_oop_basic_print_dialog]
  mojo_base.mojom.DictionaryValue system_print_dialog_data;
};