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 // This API exposes events used by print manager to query printers controlled
6 // by extensions, to query capabilities of them and to submit print jobs to
8 namespace printerProvider {
9 // Error codes used by providing extensions in response to requests.
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 {
29 // Unique ID of printer.
32 // Human readable display name of printer.
35 // Human readable description of printer.
36 DOMString? description;
39 // Parameters of $(ref:onPrintRequested).
41 // ID of the printer to submit the job.
44 // print ticket in CJT format described at
45 // https://developers.google.com/cloud-print/docs/cdd#cjt
48 // Content type of the document. Supported formats are "application/pdf" and
49 // "image/pwg-raster".
50 DOMString contentType;
52 // Buffer with document to printer. Format must match |contentType|.
56 callback PrintersCallback = void(PrinterInfo[] printerInfo);
57 callback CapabilitiesCallback = void(object capabilities);
58 callback PrintCallback = void(PrintError result);
61 // Event fired when print manager requests printers provided by extension.
62 // |resultCallback| : callback to return printer list. Every listener must
63 // call callback exactly once.
64 static void onGetPrintersRequested(PrintersCallback resultCallback);
66 // Event fired when print manager requests printer capabilities.
67 // |printerId| : unique ID of the printer.
68 // |resultCallback| : callback to return device capabilities in CDD format
69 // as described at https://developers.google.com/cloud-print/docs/cdd#cdd.
70 // The receiving listener must call callback exectly once.
71 static void onGetCapabilityRequested(DOMString printerId,
72 CapabilitiesCallback resultCallback);
74 // Event fired when print manager requests printing.
75 // |printJob| : parameters of printing request.
76 static void onPrintRequested(PrintJob printJob,
77 PrintCallback resultCallback);