summaryrefslogtreecommitdiff
path: root/chromium/components/arc/common/print.mojom
blob: f74d468ca4cb83bd02d8376209905b98c198b3b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
// 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) => ();
};