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.documentScan</code> API to discover and retrieve
6// images from attached paper document scanners.
7[platforms=("chromeos"),
8implemented_in="chrome/browser/chromeos/extensions/document_scan/document_scan_api.h"]
9namespace documentScan {
10  dictionary ScanOptions {
11    // The MIME types that are accepted by the caller.
12    DOMString[]? mimeTypes;
13
14    // The number of scanned images allowed (defaults to 1).
15    long? maxImages;
16  };
17
18  dictionary ScanResults {
19    // The data image URLs in a form that can be passed as the "src" value to
20    // an image tag.
21    DOMString[] dataUrls;
22
23    // The MIME type of <code>dataUrls</code>.
24    DOMString mimeType;
25  };
26
27  // Callback from the <code>scan</code> method.
28  // |result| The results from the scan, if successful.
29  // Otherwise will return null and set runtime.lastError.
30  callback ScanCallback = void (ScanResults result);
31
32  interface Functions {
33    // Performs a document scan.  On success, the PNG data will be
34    // sent to the callback.
35    // |options| : Object containing scan parameters.
36    // |callback| : Called with the result and data from the scan.
37    static void scan(ScanOptions options, ScanCallback callback);
38  };
39};
40