| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 // <code>"application/pdf"</code> and <code>"image/pwg-raster"</code>. | 53 // <code>"application/pdf"</code> and <code>"image/pwg-raster"</code>. |
| 54 DOMString contentType; | 54 DOMString contentType; |
| 55 | 55 |
| 56 // Blob containing the document data to print. Format must match | 56 // Blob containing the document data to print. Format must match |
| 57 // |contentType|. | 57 // |contentType|. |
| 58 [instanceOf=Blob] object document; | 58 [instanceOf=Blob] object document; |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 callback PrintersCallback = void(PrinterInfo[] printerInfo); | 61 callback PrintersCallback = void(PrinterInfo[] printerInfo); |
| 62 | 62 |
| 63 callback PrinterInfoCallback = void(optional PrinterInfo printerInfo); |
| 64 |
| 63 // |capabilities|: Device capabilities in | 65 // |capabilities|: Device capabilities in |
| 64 // <a href="https://developers.google.com/cloud-print/docs/cdd#cdd">CDD | 66 // <a href="https://developers.google.com/cloud-print/docs/cdd#cdd">CDD |
| 65 // format</a>. | 67 // format</a>. |
| 66 callback CapabilitiesCallback = void(object capabilities); | 68 callback CapabilitiesCallback = void(object capabilities); |
| 67 | 69 |
| 68 callback PrintCallback = void(PrintError result); | 70 callback PrintCallback = void(PrintError result); |
| 69 | 71 |
| 70 interface Events { | 72 interface Events { |
| 71 // Event fired when print manager requests printers provided by extensions. | 73 // Event fired when print manager requests printers provided by extensions. |
| 72 // |resultCallback|: Callback to return printer list. Every listener must | 74 // |resultCallback|: Callback to return printer list. Every listener must |
| 73 // call callback exactly once. | 75 // call callback exactly once. |
| 74 static void onGetPrintersRequested(PrintersCallback resultCallback); | 76 static void onGetPrintersRequested(PrintersCallback resultCallback); |
| 75 | 77 |
| 78 // Event fired when print manager requests information about a USB device |
| 79 // that may be a printer. |
| 80 // <p><em>Note:</em> An application should not rely on this event being |
| 81 // fired more than once per device. If a connected device is supported it |
| 82 // should be returned in the $(ref:onGetPrintersRequested) event.</p> |
| 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 |
| 87 // device is not supported. |
| 88 static void onGetUsbPrinterInfoRequested( |
| 89 usb.Device device, |
| 90 PrinterInfoCallback resultCallback); |
| 91 |
| 76 // Event fired when print manager requests printer capabilities. | 92 // Event fired when print manager requests printer capabilities. |
| 77 // |printerId|: Unique ID of the printer whose capabilities are requested. | 93 // |printerId|: Unique ID of the printer whose capabilities are requested. |
| 78 // |resultCallback|: Callback to return device capabilities in | 94 // |resultCallback|: Callback to return device capabilities in |
| 79 // <a href="https://developers.google.com/cloud-print/docs/cdd#cdd">CDD | 95 // <a href="https://developers.google.com/cloud-print/docs/cdd#cdd">CDD |
| 80 // format</a>. | 96 // format</a>. |
| 81 // The receiving listener must call callback exectly once. | 97 // The receiving listener must call callback exectly once. |
| 82 static void onGetCapabilityRequested(DOMString printerId, | 98 static void onGetCapabilityRequested(DOMString printerId, |
| 83 CapabilitiesCallback resultCallback); | 99 CapabilitiesCallback resultCallback); |
| 84 | 100 |
| 85 // Event fired when print manager requests printing. | 101 // Event fired when print manager requests printing. |
| 86 // |printJob|: The printing request parameters. | 102 // |printJob|: The printing request parameters. |
| 87 // |resultCallback|: Callback that should be called when the printing | 103 // |resultCallback|: Callback that should be called when the printing |
| 88 // request is completed. | 104 // request is completed. |
| 89 static void onPrintRequested(PrintJob printJob, | 105 static void onPrintRequested(PrintJob printJob, |
| 90 PrintCallback resultCallback); | 106 PrintCallback resultCallback); |
| 91 }; | 107 }; |
| 92 }; | 108 }; |
| 93 | 109 |
| OLD | NEW |