Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / extensions / common / api / printer_provider_internal.idl
blobd34e472ffff57f7d8fe076b46976f7efb9e8f399
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
7 // events.
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.
20 dictionary BlobInfo {
21 // The blob UUID.
22 DOMString blobUuid;
24 // The blob content type.
25 DOMString type;
27 // The blob size.
28 long size;
31 // Callback carrying information needed by a renderer to create a blob.
32 callback BlobCallback = void(BlobInfo blobInfo);
34 interface Functions {
35 // Runs callback to printerProvider.onGetPrintersRequested event.
36 // |requestId|: Parameter identifying the event instance for which the
37 // callback is run.
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
44 // callback is run.
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
51 // callback is run.
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
57 // callback is run.
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
65 // needed.
66 // |callback|: Callback called with the information needed to create a blob
67 // of print data.
68 void getPrintData(long requestId, BlobCallback callback);