naiveproxy/components/arc/common/print.mojom

203 lines
5.1 KiB
Plaintext
Raw Normal View History

2018-12-10 05:59:24 +03:00
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Next MinVersion: 2
module arc.mojom;
// android.print.PageRange
struct PrintPageRange {
// First page inclusive.
int32 start;
// Last page inclusive.
int32 end;
};
// android.print.PrintAttributes.MediaSize
struct PrintMediaSize {
// Id unique among media sizes.
string id;
// Localized label.
string label;
int32 width_mils;
int32 height_mils;
};
// android.print.PrintAttributes.Resolution
struct PrintResolution {
// Id unique among resolutions.
string id;
// Localized label.
string label;
int32 horizontal_dpi;
int32 vertical_dpi;
};
// android.print.PrintAttributes.Margins
struct PrintMargins {
int32 left_mils;
int32 top_mils;
int32 right_mils;
int32 bottom_mils;
};
// android.print.PrintAttributes.COLOR_MODE_*
[Extensible]
enum PrintColorMode {
MONOCHROME = 1,
COLOR = 2,
};
// android.print.PrintAttributes.DUPLEX_MODE_*
[Extensible]
enum PrintDuplexMode {
NONE = 1,
LONG_EDGE = 2,
SHORT_EDGE = 4,
};
// android.print.PrintDocumentInfo.CONTENT_TYPE_*
[Extensible]
enum PrintContentType {
UNKNOWN = -1,
DOCUMENT = 0,
PHOTO = 1,
};
// android.print.PrintAttributes
struct PrintAttributes {
PrintMediaSize? media_size;
PrintResolution? resolution;
PrintMargins? min_margins;
PrintColorMode color_mode;
PrintDuplexMode duplex_mode;
};
struct PrintJobRequest {
// android.printservice.PrintJob fields:
array<int8> id;
string label;
string? printer_id;
int64 creation_time;
int32 copies;
array<PrintPageRange> pages;
PrintAttributes attributes;
// android.print.PrintDocumentInfo fields:
string document_name;
int32 document_page_count;
PrintContentType content_type;
int64 data_size;
// android.printservice.PrintDocument fields:
handle? data;
};
// android.print.PrinterInfo.STATUS_*
[Extensible]
enum PrinterStatus {
IDLE = 1,
BUSY = 2,
UNAVAILABLE = 3,
};
// android.print.PrinterCapabilitiesInfo
struct PrinterCapabilities {
array<PrintMediaSize> media_sizes;
array<PrintResolution> resolutions;
PrintMargins min_margins;
PrintColorMode color_modes;
PrintDuplexMode duplex_modes;
PrintAttributes defaults;
};
// android.print.PrinterInfo
struct PrinterInfo {
// Id unique among printers.
string id;
// Localized name.
string name;
PrinterStatus status;
// Localized description.
string? description;
// Intent for provider-specific settings.
string? info_intent;
PrinterCapabilities? capabilities;
};
// android.printservice.PrinterDiscoverySession implementation.
// This is called by container when printing is requested and printer discovery
// has to start. Implemented in embedder.
// The normal order this is called is:
// StartPrinterDiscovery
// StartPrinterStateTracking
// StopPrinterStateTracking
// StopPrinterDiscovery
// DestroyDiscoverySession
// (ValidatePrinters is not used in practice)
//
// Next method ID: 6
interface PrinterDiscoverySessionHost {
StartPrinterDiscovery@0(array<string> printer_ids);
StopPrinterDiscovery@1();
ValidatePrinters@2(array<string> printer_ids);
StartPrinterStateTracking@3(string printer_id);
StopPrinterStateTracking@4(string printer_id);
DestroyDiscoverySession@5();
};
// android.printservice.PrinterDiscoverySession final methods proxy.
// This is called by embedder when printer discovery is active.
// Implemented in container.
// Next method ID: 2
interface PrinterDiscoverySessionInstance {
AddPrinters@0(array<PrinterInfo> printers);
RemovePrinters@1(array<string> printers);
};
// android.printservice.PrintService.onRequestCancelPrintJob implementation.
// This is called by container when job cancellation was requested.
// Implemented in embedder.
// Next method ID: 1
interface PrintJobHost {
Cancel@0();
};
// android.printservice.PrintJob proxy.
// This is called by embedder when print job status changes.
// Implemented in container.
// See https://developer.android.com/reference/android/printservice/PrintJob.html
// Next method ID: 7
interface PrintJobInstance {
Start@0();
Block@1(string? reason);
Complete@2();
Fail@3(string? reason);
Cancel@4();
SetProgress@5(float progress);
SetStatus@6(string? status);
};
// android.printservice.PrintService implementation.
// This is called by container to create new discovery sessions and print jobs.
// Implemented in embedder.
// Next method ID: 2
// Deprecated method ID: 0
interface PrintHost {
PrintDeprecated@0(handle file);
[MinVersion=1] Print@1(PrintJobInstance instance, PrintJobRequest request) => (PrintJobHost host);
[MinVersion=1] CreateDiscoverySession@2(PrinterDiscoverySessionInstance instance) =>
(PrinterDiscoverySessionHost host);
};
// This is called by embedder to indicate that it's ready to accept print jobs.
// Implemented in container.
// Next method ID: 2
// Deprecated method ID: 0
interface PrintInstance {
// DEPRECATED: Please use Init@1 instead.
InitDeprecated@0(PrintHost host_ptr);
// Establishes full-duplex communication with the host.
[MinVersion=1] Init@1(PrintHost host_ptr) => ();
};