| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Use the <code>chrome.document_scan</code> API to discover and retrieve |
| 6 // images from attached paper document scanners. |
| 7 namespace documentScan { |
| 8 |
| 9 // Represents a document scanner's properties. |
| 10 dictionary ScannerInfo { |
| 11 // The name of an connected scanner. |
| 12 DOMString name; |
| 13 |
| 14 // The manufacturer name of the scanner. |
| 15 DOMString manufacturer; |
| 16 |
| 17 // The model name of the scanner. |
| 18 DOMString model; |
| 19 |
| 20 // The type of scanner. |
| 21 DOMString type; |
| 22 }; |
| 23 |
| 24 dictionary ScanOptions { |
| 25 // The mode to perform the scan in: color, gray or lineart. |
| 26 DOMString? mode; |
| 27 |
| 28 // The resolution in dpi to perform the scan. |
| 29 long? resolutionDpi; |
| 30 }; |
| 31 |
| 32 // Callback from the <code>listScanners</code> method. |
| 33 callback ListScannersCallback = void (ScannerInfo[] scannerInfos); |
| 34 |
| 35 // Callback from the <code>scan</code> method; on success (result == true) |
| 36 // PNG image data from the scan is returned in |image_data|. The image |
| 37 // is also saved to the user's download folder. |
| 38 callback ScanCallback = void (boolean result, ArrayBuffer image_data); |
| 39 |
| 40 interface Functions { |
| 41 // Returns information about available scanners on the system. |
| 42 // The list is regenerated each time this method is called. |
| 43 // |callback| : Called with the list of <code>ScannerInfo</code> objects. |
| 44 static void listScanners(ListScannersCallback callback); |
| 45 |
| 46 // Performs a document scan. On success, ths image data will be stored in |
| 47 // the user's download folder, and the PNG data will also be |
| 48 // sent to the callback. |
| 49 // |scanner| : Name of the scanner to acquire an image from. |
| 50 // |options| : <code>ScanObject</code> object containing scan parameters. |
| 51 // |callback| : Called with the result and data from the scan. |
| 52 static void scan(DOMString scanner, ScanOptions options, |
| 53 ScanCallback callback); |
| 54 }; |
| 55 }; |
| OLD | NEW |