chromium/chrome/browser/ash/printing/history/print_job_info.proto

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

syntax = "proto3";

package ash.printing.proto;

// Required in Chrome.
option optimize_for = LITE_RUNTIME;

// The size of requested media.
message MediaSize {
  // Width (in micrometers) of the media used for printing.
  int32 width = 1;

  // Height (in micrometers) of the media used for printing.
  int32 height = 2;

  // Vendor-provided ID, e.g. "iso_a3_297x420mm" or "na_index-3x5_3x5in".
  // Possible values are values of "media" IPP attribute and can be found on
  // https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xhtml.
  string vendor_id = 3;
}

// The requested settings of print job.
message PrintSettings {
  enum ColorMode {
    BLACK_AND_WHITE = 0;
    COLOR = 1;
  }

  enum DuplexMode {
    // One-sided printing was used.
    ONE_SIDED = 0;
    // Two-sided printing was used, flipping on long edge.
    TWO_SIDED_LONG_EDGE = 1;
    // Two-sided printing was used, flipping on short edge.
    TWO_SIDED_SHORT_EDGE = 2;
  }

  // The requested color mode.
  ColorMode color = 1;

  // The requested duplex mode.
  DuplexMode duplex = 2;

  // The requested media size.
  MediaSize media_size = 3;

  // The requested number of copies.
  int32 copies = 4;
}

// The printer info.
message Printer {
  enum PrinterSource {
    // Printer was added by user.
    USER = 0;
    // Printer was added via policy.
    POLICY = 1;
  }

  // Displayed name of the printer.
  string name = 1;

  // The full path for the printer.
  // Contains protocol, hostname, port, and queue.
  string uri = 2;

  // The source of the printer.
  PrinterSource source = 3;

  // Printer ID.
  string id = 4;
}

// Print job information. The ordering of these enums must match that of
// chrome/browser/printing/print_job.h.
message PrintJobInfo {
  enum PrintJobSource {
    PRINT_PREVIEW = 0;
    ARC = 1;
    EXTENSION = 2;
    PRINT_PREVIEW_INCOGNITO = 3;
    ISOLATED_WEB_APP = 4;
  }

  enum PrintJobStatus {
    FAILED = 0;
    CANCELED = 1;
    PRINTED = 2;
  }

  // The error code of the printer. These enums are 1:1 with that of
  // chrome/browser/chromeos/printing/printer_error_codes.h.
  enum PrinterErrorCode {
    // Printer has no error.
    NO_ERROR = 0;
    // The printer has a paper jam.
    PAPER_JAM = 1;
    // The printer is out of paper.
    OUT_OF_PAPER = 2;
    // The printer is out of it.
    OUT_OF_INK = 3;
    // The door of the printer is opened.
    DOOR_OPEN = 4;
    // The printer is unreachable and does not accept new print jobs.
    PRINTER_UNREACHABLE = 5;
    // The tray fo the printer is missing.
    TRAY_MISSING = 6;
    // The output area (e.g. tray) of the printer is full.
    OUTPUT_FULL = 7;
    // The printer is stopped and doesn't print.
    STOPPED = 8;
    // The printer pipeline has died.
    FILTER_FAILED = 9;
    // Generic unknown error.
    UNKNOWN_ERROR = 10;
    // The authorization with the printer has failed.
    CLIENT_UNAUTHORIZED = 11;
    // The SSL certificate in the printer is expired.
    EXPIRED_CERTIFICATE = 12;
  }

  // The ID of the job.
  string id = 1;

  // The title of the document which was printed.
  string title = 2;

  // Source showing which component initiated the print job.
  PrintJobSource source = 3;

  // ID of source. Should be empty if source is PRINT_PREVIEW or ARC.
  string source_id = 4;

  // The final status of the job.
  PrintJobStatus status = 5;

  // The job creation time (in milliseconds past the Unix epoch).
  int64 creation_time = 6;

  // The job completion time (in milliseconds past the Unix epoch).
  int64 completion_time = 7;

  // The info about the printer which printed the document.
  Printer printer = 8;

  // The settings of the print job.
  PrintSettings settings = 9;

  // The number of pages in the document.
  int32 number_of_pages = 10;

  // The error code from the printer.
  PrinterErrorCode printer_error_code = 11;
}