Roll src/third_party/WebKit b3f094a:f697bbd (svn 194310:194313)
[chromium-blink-merge.git] / extensions / common / api / printer_provider.idl
blob40a07c5f5be874813d353c37288c2f70eb223c1d
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.
10 enum PrintError {
11 // Operation completed successfully.
12 OK,
14 // General failure.
15 FAILED,
17 // Print ticket is invalid. For example, ticket is inconsistent with
18 // capabilities or extension is not able to handle all settings from the
19 // ticket.
20 INVALID_TICKET,
22 // Document is invalid. For example, data may be corrupted or the format is
23 // incompatible with the extension.
24 INVALID_DATA
27 // Printer description for $(ref:onGetPrintersRequested) event.
28 dictionary PrinterInfo {
29 // Unique printer ID.
30 DOMString id;
32 // Printer's human readable name.
33 DOMString name;
35 // Printer's human readable description.
36 DOMString? description;
39 // Printing request parameters. Passed to $(ref:onPrintRequested) event.
40 dictionary PrintJob {
41 // ID of the printer which should handle the job.
42 DOMString printerId;
44 // The print job title.
45 DOMString title;
47 // Print ticket in
48 // <a href="https://developers.google.com/cloud-print/docs/cdd#cjt">
49 // CJT format</a>.
50 object ticket;
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
57 // |contentType|.
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
65 // format</a>.
66 callback CapabilitiesCallback = void(object capabilities);
68 callback PrintCallback = void(PrintError result);
70 interface Events {
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
80 // format</a>.
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);