1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // <p>The <code>chrome.printerProvider</code> API exposes events used by print
6 // manager to query printers controlled by extensions, to query their
7 // capabilities and to submit print jobs to these printers.
9 // <p>Available only on dev channel since Chrome 42.</p>
10 namespace printerProvider
{
11 // Error codes returned in response to $(ref:onPrintRequested) event.
13 // Operation completed successfully.
19 // Print ticket is invalid. For example, ticket is inconsistent with
20 // capabilities or extension is not able to handle all settings from the
24 // Document is invalid. For example, data may be corrupted or the format is
25 // incompatible with the extension.
29 // Printer description for $(ref:onGetPrintersRequested) event.
30 dictionary PrinterInfo
{
34 // Printer's human readable name.
37 // Printer's human readable description.
38 DOMString? description
;
41 // Printing request parameters. Passed to $(ref:onPrintRequested) event.
43 // ID of the printer which should handle the job.
47 // <a href="https://developers.google.com/cloud-print/docs/cdd#cjt">
51 // The document content type. Supported formats are
52 // <code>"application/pdf"</code> and <code>"image/pwg-raster"</code>.
53 DOMString contentType
;
55 // Buffer containing the document to print. Format must match |contentType|.
59 callback PrintersCallback
= void(PrinterInfo
[] printerInfo
);
61 // |capabilities|: Device capabilities in
62 // <a href="https://developers.google.com/cloud-print/docs/cdd#cdd">CDD
64 callback CapabilitiesCallback
= void(object capabilities
);
66 callback PrintCallback
= void(PrintError result
);
69 // Event fired when print manager requests printers provided by extensions.
70 // |resultCallback|: Callback to return printer list. Every listener must
71 // call callback exactly once.
72 static
void onGetPrintersRequested
(PrintersCallback resultCallback
);
74 // Event fired when print manager requests printer capabilities.
75 // |printerId|: Unique ID of the printer whose capabilities are requested.
76 // |resultCallback|: Callback to return device capabilities in
77 // <a href="https://developers.google.com/cloud-print/docs/cdd#cdd">CDD
79 // The receiving listener must call callback exectly once.
80 static
void onGetCapabilityRequested
(DOMString printerId
,
81 CapabilitiesCallback resultCallback
);
83 // Event fired when print manager requests printing.
84 // |printJob|: The printing request parameters.
85 // |resultCallback|: Callback that should be called when the printing
86 // request is completed.
87 static
void onPrintRequested
(PrintJob printJob
,
88 PrintCallback resultCallback
);