Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 // The <code>chrome.printerProvider</code> API exposes events used by print | 5 // The <code>chrome.printerProvider</code> API exposes events used by print |
| 6 // manager to query printers controlled by extensions, to query their | 6 // manager to query printers controlled by extensions, to query their |
| 7 // capabilities and to submit print jobs to these printers. | 7 // capabilities and to submit print jobs to these printers. |
| 8 namespace printerProvider { | 8 namespace printerProvider { |
| 9 // Error codes returned in response to $(ref:onPrintRequested) event. | 9 // Error codes returned in response to $(ref:onPrintRequested) event. |
| 10 enum PrintError { | 10 enum PrintError { |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 // Printer description for $(ref:onGetPrintersRequested) event. | 27 // Printer description for $(ref:onGetPrintersRequested) event. |
| 28 dictionary PrinterInfo { | 28 dictionary PrinterInfo { |
| 29 // Unique printer ID. | 29 // Unique printer ID. |
| 30 DOMString id; | 30 DOMString id; |
| 31 | 31 |
| 32 // Printer's human readable name. | 32 // Printer's human readable name. |
| 33 DOMString name; | 33 DOMString name; |
| 34 | 34 |
| 35 // Printer's human readable description. | 35 // Printer's human readable description. |
| 36 DOMString? description; | 36 DOMString? description; |
| 37 | |
| 38 // USB device corresponding to this printer. This should be the | |
| 39 // opaque ID found in the $(ref:usb.Device) dictionary. | |
| 40 long? usbDevice; | |
| 37 }; | 41 }; |
| 38 | 42 |
| 39 // Printing request parameters. Passed to $(ref:onPrintRequested) event. | 43 // Printing request parameters. Passed to $(ref:onPrintRequested) event. |
| 40 dictionary PrintJob { | 44 dictionary PrintJob { |
| 41 // ID of the printer which should handle the job. | 45 // ID of the printer which should handle the job. |
| 42 DOMString printerId; | 46 DOMString printerId; |
| 43 | 47 |
| 44 // The print job title. | 48 // The print job title. |
| 45 DOMString title; | 49 DOMString title; |
| 46 | 50 |
| 47 // Print ticket in | 51 // Print ticket in |
| 48 // <a href="https://developers.google.com/cloud-print/docs/cdd#cjt"> | 52 // <a href="https://developers.google.com/cloud-print/docs/cdd#cjt"> |
| 49 // CJT format</a>. | 53 // CJT format</a>. |
| 50 object ticket; | 54 object ticket; |
| 51 | 55 |
| 52 // The document content type. Supported formats are | 56 // The document content type. Supported formats are |
| 53 // <code>"application/pdf"</code> and <code>"image/pwg-raster"</code>. | 57 // <code>"application/pdf"</code> and <code>"image/pwg-raster"</code>. |
| 54 DOMString contentType; | 58 DOMString contentType; |
| 55 | 59 |
| 56 // Blob containing the document data to print. Format must match | 60 // Blob containing the document data to print. Format must match |
| 57 // |contentType|. | 61 // |contentType|. |
| 58 [instanceOf=Blob] object document; | 62 [instanceOf=Blob] object document; |
| 59 }; | 63 }; |
| 60 | 64 |
| 61 callback PrintersCallback = void(PrinterInfo[] printerInfo); | 65 callback PrintersCallback = void(PrinterInfo[] printerInfo); |
| 62 | 66 |
| 67 callback PrinterInfoCallback = void(PrinterInfo printerInfo); | |
| 68 | |
| 63 // |capabilities|: Device capabilities in | 69 // |capabilities|: Device capabilities in |
| 64 // <a href="https://developers.google.com/cloud-print/docs/cdd#cdd">CDD | 70 // <a href="https://developers.google.com/cloud-print/docs/cdd#cdd">CDD |
| 65 // format</a>. | 71 // format</a>. |
| 66 callback CapabilitiesCallback = void(object capabilities); | 72 callback CapabilitiesCallback = void(object capabilities); |
| 67 | 73 |
| 68 callback PrintCallback = void(PrintError result); | 74 callback PrintCallback = void(PrintError result); |
| 69 | 75 |
| 70 interface Events { | 76 interface Events { |
| 71 // Event fired when print manager requests printers provided by extensions. | 77 // Event fired when print manager requests printers provided by extensions. |
| 72 // |resultCallback|: Callback to return printer list. Every listener must | 78 // |resultCallback|: Callback to return printer list. Every listener must |
| 73 // call callback exactly once. | 79 // call callback exactly once. |
| 74 static void onGetPrintersRequested(PrintersCallback resultCallback); | 80 static void onGetPrintersRequested(PrintersCallback resultCallback); |
| 75 | 81 |
| 82 // Event fired when print manager grants access to a USB device. | |
| 83 // |device|: The USB device. | |
| 84 // |resultCallback|: Callback to return printer info. The receiving listener | |
| 85 // must call callback exactly once. If the parameter to this callback is | |
| 86 // undefined that indicates that the application has determined that the | |
|
Vitaly Buka (NO REVIEWS)
2015/05/21 00:52:02
Looks like this even should be in chrome.usb
Idea
Reilly Grant (use Gerrit)
2015/05/21 00:58:22
I could add this event to chrome.usb but I would n
| |
| 87 // device is not supported. | |
| 88 static void onUsbAccessGranted(usb.Device device, | |
| 89 PrinterInfoCallback resultCallback); | |
| 90 | |
| 76 // Event fired when print manager requests printer capabilities. | 91 // Event fired when print manager requests printer capabilities. |
| 77 // |printerId|: Unique ID of the printer whose capabilities are requested. | 92 // |printerId|: Unique ID of the printer whose capabilities are requested. |
| 78 // |resultCallback|: Callback to return device capabilities in | 93 // |resultCallback|: Callback to return device capabilities in |
| 79 // <a href="https://developers.google.com/cloud-print/docs/cdd#cdd">CDD | 94 // <a href="https://developers.google.com/cloud-print/docs/cdd#cdd">CDD |
| 80 // format</a>. | 95 // format</a>. |
| 81 // The receiving listener must call callback exectly once. | 96 // The receiving listener must call callback exectly once. |
| 82 static void onGetCapabilityRequested(DOMString printerId, | 97 static void onGetCapabilityRequested(DOMString printerId, |
| 83 CapabilitiesCallback resultCallback); | 98 CapabilitiesCallback resultCallback); |
| 84 | 99 |
| 85 // Event fired when print manager requests printing. | 100 // Event fired when print manager requests printing. |
| 86 // |printJob|: The printing request parameters. | 101 // |printJob|: The printing request parameters. |
| 87 // |resultCallback|: Callback that should be called when the printing | 102 // |resultCallback|: Callback that should be called when the printing |
| 88 // request is completed. | 103 // request is completed. |
| 89 static void onPrintRequested(PrintJob printJob, | 104 static void onPrintRequested(PrintJob printJob, |
| 90 PrintCallback resultCallback); | 105 PrintCallback resultCallback); |
| 91 }; | 106 }; |
| 92 }; | 107 }; |
| 93 | 108 |
| OLD | NEW |