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.
5 #ifndef EXTENSIONS_BROWSER_API_DOCUMENT_SCAN_DOCUMENT_SCAN_API_H_
6 #define EXTENSIONS_BROWSER_API_DOCUMENT_SCAN_DOCUMENT_SCAN_API_H_
11 #include "base/memory/scoped_ptr.h"
12 #include "extensions/browser/api/async_api_function.h"
13 #include "extensions/browser/api/document_scan/document_scan_interface.h"
14 #include "extensions/common/api/document_scan.h"
16 namespace extensions
{
20 class DocumentScanScanFunction
: public AsyncApiFunction
{
22 DECLARE_EXTENSION_FUNCTION("documentScan.scan", DOCUMENT_SCAN_SCAN
)
23 DocumentScanScanFunction();
26 ~DocumentScanScanFunction() override
;
29 bool Prepare() override
;
30 void AsyncWorkStart() override
;
31 bool Respond() override
;
34 friend class DocumentScanScanFunctionTest
;
36 void OnScannerListReceived(
37 const std::vector
<DocumentScanInterface::ScannerDescription
>&
39 const std::string
& error
);
40 void OnResultsReceived(const std::string
& scanned_image
,
41 const std::string
& mime_type
,
42 const std::string
& error
);
44 scoped_ptr
<document_scan::Scan::Params
> params_
;
45 scoped_ptr
<DocumentScanInterface
> document_scan_interface_
;
47 DISALLOW_COPY_AND_ASSIGN(DocumentScanScanFunction
);
52 } // namespace extensions
54 #endif // EXTENSIONS_BROWSER_API_DOCUMENT_SCAN_DOCUMENT_SCAN_API_H_