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 // 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.
8 namespace printerProvider
{
9 // Error codes returned in response to $(ref:onPrintRequested) event.
11 // Operation completed successfully.
17 // Print ticket is invalid. For example, ticket is inconsistent with
18 // capabilities or extension is not able to handle all settings from the
22 // Document is invalid. For example, data may be corrupted or the format is
23 // incompatible with the extension.
27 // Printer description for $(ref:onGetPrintersRequested) event.
28 dictionary PrinterInfo
{
32 // Printer's human readable name.
35 // Printer's human readable description.
36 DOMString? description
;
39 // Printing request parameters. Passed to $(ref:onPrintRequested) event.
41 // ID of the printer which should handle the job.
44 // The print job title.
48 // <a href="https://developers.google.com/cloud-print/docs/cdd#cjt">
52 // The document content type. Supported formats are
53 // <code>"application/pdf"</code> and <code>"image/pwg-raster"</code>.
54 DOMString contentType
;
56 // Blob containing the document data to print. Format must match
58 [instanceOf
=Blob
] object document
;
61 callback PrintersCallback
= void(PrinterInfo
[] printerInfo
);
63 // |capabilities|: Device capabilities in
64 // <a href="https://developers.google.com/cloud-print/docs/cdd#cdd">CDD
66 callback CapabilitiesCallback
= void(object capabilities
);
68 callback PrintCallback
= void(PrintError result
);
71 // Event fired when print manager requests printers provided by extensions.
72 // |resultCallback|: Callback to return printer list. Every listener must
73 // call callback exactly once.
74 static
void onGetPrintersRequested
(PrintersCallback resultCallback
);
76 // Event fired when print manager requests printer capabilities.
77 // |printerId|: Unique ID of the printer whose capabilities are requested.
78 // |resultCallback|: Callback to return device capabilities in
79 // <a href="https://developers.google.com/cloud-print/docs/cdd#cdd">CDD
81 // The receiving listener must call callback exectly once.
82 static
void onGetCapabilityRequested
(DOMString printerId
,
83 CapabilitiesCallback resultCallback
);
85 // Event fired when print manager requests printing.
86 // |printJob|: The printing request parameters.
87 // |resultCallback|: Callback that should be called when the printing
88 // request is completed.
89 static
void onPrintRequested
(PrintJob printJob
,
90 PrintCallback resultCallback
);