File: printing.idl

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (213 lines) | stat: -rw-r--r-- 7,195 bytes parent folder | download | duplicates (6)
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
203
204
205
206
207
208
209
210
211
212
213
// 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.

// Use the <code>chrome.printing</code> API to send print jobs to printers
// installed on Chromebook.
[platforms=("chromeos"),
implemented_in="chrome/browser/extensions/api/printing/printing_api.h"]
namespace printing {
  dictionary SubmitJobRequest {
    // The print job to be submitted.
    // Supported content types are "application/pdf" and "image/png". The
    // <a href="https://developers.google.com/cloud-print/docs/cdd#cjt">Cloud Job Ticket</a>
    // shouldn't include <code>FitToPageTicketItem</code>,
    // <code>PageRangeTicketItem</code> and <code>ReverseOrderTicketItem</code>
    // fields since they are irrelevant for native printing.
    // <code>VendorTicketItem</code> is optional. All other fields must be
    // present.
    printerProvider.PrintJob job;

    // Used internally to store the blob uuid after parameter customization and
    // shouldn't be populated by the extension.
    [nodoc] DOMString? documentBlobUuid;
  };

  // The status of $(ref:submitJob) request.
  enum SubmitJobStatus {
    // Sent print job request is accepted.
    OK,

    // Sent print job request is rejected by the user.
    USER_REJECTED
  };

  // Response for $(ref:submitJob) request.
  dictionary SubmitJobResponse {
    // The status of the request.
    SubmitJobStatus status;

    // The id of created print job. This is a unique identifier among all print
    // jobs on the device. If status is not OK, jobId will be null.
    DOMString? jobId;
  };

  // The source of the printer.
  enum PrinterSource {
    // Printer was added by user.
    USER,

    // Printer was added via policy.
    POLICY
  };

  // Description of the printer.
  dictionary Printer {
    // The printer's identifier; guaranteed to be unique among printers on the
    // device.
    DOMString id;

    // The name of the printer.
    DOMString name;

    // The human-readable description of the printer.
    DOMString description;

    // The printer URI. This can be used by extensions to choose the printer for
    // the user.
    DOMString uri;

    // The source of the printer (user or policy configured).
    PrinterSource source;

    // The flag which shows whether the printer fits
    // <a href="https://chromium.org/administrators/policy-list-3#DefaultPrinterSelection">
    // DefaultPrinterSelection</a> rules.
    // Note that several printers could be flagged.
    boolean isDefault;

    // The value showing how recent the printer was used for printing from
    // Chrome. The lower the value is the more recent the printer was used. The
    // minimum value is 0. Missing value indicates that the printer wasn't used
    // recently. This value is guaranteed to be unique amongst printers.
    long? recentlyUsedRank;
  };

  // The status of the printer.
  enum PrinterStatus {
    // The door of the printer is open. Printer still accepts print jobs.
    DOOR_OPEN,

    // The tray of the printer is missing. Printer still accepts print jobs.
    TRAY_MISSING,

    // The printer is out of ink. Printer still accepts print jobs.
    OUT_OF_INK,

    // The printer is out of paper. Printer still accepts print jobs.
    OUT_OF_PAPER,

    // The output area of the printer (e.g. tray) is full. Printer still accepts
    // print jobs.
    OUTPUT_FULL,

    // The printer has a paper jam. Printer still accepts print jobs.
    PAPER_JAM,

    // Some generic issue. Printer still accepts print jobs.
    GENERIC_ISSUE,

    // The printer is stopped and doesn't print but still accepts print jobs.
    STOPPED,

    // The printer is unreachable and doesn't accept print jobs.
    UNREACHABLE,

    // The SSL certificate is expired. Printer accepts jobs but they fail.
    EXPIRED_CERTIFICATE,

    // The printer is available.
    AVAILABLE
  };

  // Response for $(ref:getPrinterInfo) request.
  dictionary GetPrinterInfoResponse {
    // Printer capabilities in
    // <a href="https://developers.google.com/cloud-print/docs/cdd#cdd">
    // CDD format</a>.
    // The property may be missing.
    object? capabilities;

    // The status of the printer.
    PrinterStatus status;
  };

  // Status of the print job.
  enum JobStatus {
    // Print job is received on Chrome side but was not processed yet.
    PENDING,

    // Print job is sent for printing.
    IN_PROGRESS,

    // Print job was interrupted due to some error.
    FAILED,

    // Print job was canceled by the user or via API.
    CANCELED,

    // Print job was printed without any errors.
    PRINTED
  };

  callback SubmitJobCallback = void(SubmitJobResponse response);
  callback CancelJobCallback = void();
  callback GetPrintersCallback = void(Printer[] printers);
  callback GetPrinterInfoCallback = void(GetPrinterInfoResponse response);
  callback getJobStatusCallback = void(JobStatus status);

  interface Functions {
    // Submits the job for printing. If the extension is not listed in
    // the <a href="https://chromeenterprise.google/policies/#PrintingAPIExtensionsAllowlist">
    // <code>PrintingAPIExtensionsAllowlist</code></a> policy,
    // the user is prompted to accept the print job.<br/>
    // Before Chrome 120, this function did not return a promise.
    static void submitJob(
        SubmitJobRequest request,
        SubmitJobCallback callback);

    // Cancels previously submitted job.
    // |jobId|: The id of the print job to cancel. This should be the same id
    // received in a $(ref:SubmitJobResponse).
    static void cancelJob(
        DOMString jobId,
        CancelJobCallback callback);

    // Returns the list of available printers on the device. This includes
    // manually added, enterprise and discovered printers.
    static void getPrinters(GetPrintersCallback callback);

    // Returns the status and capabilities of the printer in
    // <a href="https://developers.google.com/cloud-print/docs/cdd#cdd">
    // CDD format</a>.
    // This call will fail with a runtime error if no printers with given id are
    // installed.
    static void getPrinterInfo(
        DOMString printerId,
        GetPrinterInfoCallback callback);

    // Returns the status of the print job. This call will fail with a runtime
    // error if the print job with the given `jobId` doesn't exist.
    // `jobId`: The id of the print job to return the status of. This should be
    // the same id received in a $(ref:SubmitJobResponse).
    static void getJobStatus(
        DOMString jobId,
        getJobStatusCallback callback);
  };

  interface Properties {
    // The maximum number of times that $(ref:submitJob) can be called per
    // minute.
    [value=40] static long MAX_SUBMIT_JOB_CALLS_PER_MINUTE();

    // The maximum number of times that $(ref:getPrinterInfo) can be called per
    // minute.
    [value=20] static long MAX_GET_PRINTER_INFO_CALLS_PER_MINUTE();
  };

  interface Events {
    // Event fired when the status of the job is changed.
    // This is only fired for the jobs created by this extension.
    static void onJobStatusChanged(DOMString jobId, JobStatus status);
  };
};