Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / extensions / browser / api / document_scan / document_scan_api.h
blobe2d1a186c37de1fa917f7f4db23997016ab833e9
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_
8 #include <string>
9 #include <vector>
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 {
18 namespace api {
20 class DocumentScanScanFunction : public AsyncApiFunction {
21 public:
22 DECLARE_EXTENSION_FUNCTION("documentScan.scan", DOCUMENT_SCAN_SCAN)
23 DocumentScanScanFunction();
25 protected:
26 ~DocumentScanScanFunction() override;
28 // AsyncApiFunction:
29 bool Prepare() override;
30 void AsyncWorkStart() override;
31 bool Respond() override;
33 private:
34 friend class DocumentScanScanFunctionTest;
36 void OnScannerListReceived(
37 const std::vector<DocumentScanInterface::ScannerDescription>&
38 scanner_descriptions,
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);
50 } // namespace api
52 } // namespace extensions
54 #endif // EXTENSIONS_BROWSER_API_DOCUMENT_SCAN_DOCUMENT_SCAN_API_H_