OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // printerProviderInternal | 5 // printerProviderInternal |
6 // Internal API used to run callbacks passed to chrome.printerProvider API | 6 // Internal API used to run callbacks passed to chrome.printerProvider API |
7 // events. | 7 // events. |
8 // When dispatching a chrome.printerProvider API event, its arguments will be | 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 | 9 // massaged in custom bindings so a callback is added. The callback uses |
10 // chrome.printerProviderInternal API to report the event results. | 10 // chrome.printerProviderInternal API to report the event results. |
11 // In order to identify the event for which the callback is called, the event | 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 | 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 | 13 // the argument list before the event actually reaches the event listeners). The |
14 // requestId is forwarded to the chrome.printerProviderInternal API functions. | 14 // requestId is forwarded to the chrome.printerProviderInternal API functions. |
15 namespace printerProviderInternal { | 15 namespace printerProviderInternal { |
16 // Same as in printerProvider.PrintError enum API. | 16 // Same as in printerProvider.PrintError enum API. |
17 enum PrintError { OK, FAILED, INVALID_TICKET, INVALID_DATA }; | 17 enum PrintError { OK, FAILED, INVALID_TICKET, INVALID_DATA }; |
18 | 18 |
19 // Information needed by a renderer to create a blob instance. | |
20 dictionary BlobInfo { | |
21 // The blob UUID. | |
22 DOMString blobUuid; | |
23 | |
24 // The blob content type. | |
25 DOMString type; | |
26 | |
27 // The blob size. | |
28 long size; | |
not at google - send to devlin
2015/03/04 21:54:49
Wow, big print job :-)
| |
29 }; | |
30 | |
31 // Callback carrying information needed by a renderer to create a blob. | |
32 callback BlobCallback = void(BlobInfo blobInfo); | |
33 | |
19 interface Functions { | 34 interface Functions { |
20 // Runs callback to printerProvider.onGetPrintersRequested event. | 35 // Runs callback to printerProvider.onGetPrintersRequested event. |
21 // |requestId|: Parameter identifying the event instance for which the | 36 // |requestId|: Parameter identifying the event instance for which the |
22 // callback is run. | 37 // callback is run. |
23 // |printers|: List of printers reported by the extension. | 38 // |printers|: List of printers reported by the extension. |
24 void reportPrinters(long requestId, | 39 void reportPrinters(long requestId, |
25 optional printerProvider.PrinterInfo[] printers); | 40 optional printerProvider.PrinterInfo[] printers); |
26 | 41 |
27 // Runs callback to printerProvider.onGetCapabilityRequested event. | 42 // Runs callback to printerProvider.onGetCapabilityRequested event. |
28 // |requestId|: Parameter identifying the event instance for which the | 43 // |requestId|: Parameter identifying the event instance for which the |
29 // callback is run. | 44 // callback is run. |
30 // |error|: The printer capability returned by the extension. | 45 // |error|: The printer capability returned by the extension. |
31 void reportPrinterCapability(long request_id, optional object capability); | 46 void reportPrinterCapability(long request_id, optional object capability); |
32 | 47 |
33 // Runs callback to printerProvider.onPrintRequested event. | 48 // Runs callback to printerProvider.onPrintRequested event. |
34 // |requestId|: Parameter identifying the event instance for which the | 49 // |requestId|: Parameter identifying the event instance for which the |
35 // callback is run. | 50 // callback is run. |
36 // |error|: The requested print job result. | 51 // |error|: The requested print job result. |
37 void reportPrintResult(long request_id, optional PrintError error); | 52 void reportPrintResult(long request_id, optional PrintError error); |
53 | |
54 // Gets information needed to create a print data blob for a print request. | |
55 // The blob will be dispatched to the extension via | |
56 // printerProvider.onPrintRequested event. | |
57 // |requestId|: The request id for the print request for which data is | |
58 // needed. | |
59 // |callback|: Callback called with the information needed to create a blob | |
60 // of print data. | |
61 void getPrintData(long requestId, BlobCallback callback); | |
38 }; | 62 }; |
39 }; | 63 }; |
40 | 64 |
OLD | NEW |