1 // Copyright 2015 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 // printerProviderInternal
6 // Internal API used to run callbacks passed to chrome.printerProvider API
8 // When dispatching a chrome.printerProvider API event, its arguments will be
9 // massaged in custom bindings so a callback is added. The callback uses
10 // chrome.printerProviderInternal API to report the event results.
11 // In order to identify the event for which the callback is called, the event
12 // is internally dispatched having a requestId argument (which is removed from
13 // the argument list before the event actually reaches the event listeners). The
14 // requestId is forwarded to the chrome.printerProviderInternal API functions.
15 namespace printerProviderInternal
{
16 // Same as in printerProvider.PrintError enum API.
17 enum PrintError
{ OK
, FAILED
, INVALID_TICKET
, INVALID_DATA
};
19 // Information needed by a renderer to create a blob instance.
24 // The blob content type.
31 // Callback carrying information needed by a renderer to create a blob.
32 callback BlobCallback
= void(BlobInfo blobInfo
);
35 // Runs callback to printerProvider.onGetPrintersRequested event.
36 // |requestId|: Parameter identifying the event instance for which the
38 // |printers|: List of printers reported by the extension.
39 void reportPrinters
(long requestId
,
40 optional printerProvider.PrinterInfo
[] printers
);
42 // Runs callback to printerProvider.onUsbAccessGranted event.
43 // |requestId|: Parameter identifying the event instance for which the
45 // |printerInfo|: Printer information reported by the extension.
46 void reportUsbPrinterInfo
(long requestId
,
47 optional printerProvider.PrinterInfo printerInfo
);
49 // Runs callback to printerProvider.onGetCapabilityRequested event.
50 // |requestId|: Parameter identifying the event instance for which the
52 // |error|: The printer capability returned by the extension.
53 void reportPrinterCapability
(long request_id
, optional object capability
);
55 // Runs callback to printerProvider.onPrintRequested event.
56 // |requestId|: Parameter identifying the event instance for which the
58 // |error|: The requested print job result.
59 void reportPrintResult
(long request_id
, optional PrintError error
);
61 // Gets information needed to create a print data blob for a print request.
62 // The blob will be dispatched to the extension via
63 // printerProvider.onPrintRequested event.
64 // |requestId|: The request id for the print request for which data is
66 // |callback|: Callback called with the information needed to create a blob
68 void getPrintData
(long requestId
, BlobCallback
callback);