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 #ifndef EXTENSIONS_BROWSER_API_DOCUMENT_SCAN_DOCUMENT_SCAN_API_H_ |
| 6 #define EXTENSIONS_BROWSER_API_DOCUMENT_SCAN_DOCUMENT_SCAN_API_H_ |
| 7 |
5 #include <string> | 8 #include <string> |
6 #include <vector> | 9 #include <vector> |
7 | 10 |
8 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
9 #include "chrome/browser/extensions/api/document_scan/document_scan_interface.h" | |
10 #include "chrome/common/extensions/api/document_scan.h" | |
11 #include "extensions/browser/api/async_api_function.h" | 12 #include "extensions/browser/api/async_api_function.h" |
12 | 13 #include "extensions/browser/api/document_scan/document_scan_interface.h" |
13 #ifndef CHROME_BROWSER_EXTENSIONS_API_DOCUMENT_SCAN_DOCUMENT_SCAN_API_H_ | 14 #include "extensions/common/api/document_scan.h" |
14 #define CHROME_BROWSER_EXTENSIONS_API_DOCUMENT_SCAN_DOCUMENT_SCAN_API_H_ | |
15 | 15 |
16 namespace extensions { | 16 namespace extensions { |
17 | 17 |
18 namespace api { | 18 namespace core_api { |
19 | 19 |
20 class DocumentScanScanFunction : public AsyncApiFunction { | 20 class DocumentScanScanFunction : public AsyncApiFunction { |
21 public: | 21 public: |
22 DECLARE_EXTENSION_FUNCTION("documentScan.scan", | 22 DECLARE_EXTENSION_FUNCTION("documentScan.scan", DOCUMENT_SCAN_SCAN) |
23 DOCUMENT_SCAN_SCAN) | |
24 DocumentScanScanFunction(); | 23 DocumentScanScanFunction(); |
25 | 24 |
26 protected: | 25 protected: |
27 ~DocumentScanScanFunction() override; | 26 ~DocumentScanScanFunction() override; |
28 | 27 |
29 // AsyncApiFunction: | 28 // AsyncApiFunction: |
30 bool Prepare() override; | 29 bool Prepare() override; |
31 void AsyncWorkStart() override; | 30 void AsyncWorkStart() override; |
32 bool Respond() override; | 31 bool Respond() override; |
33 | 32 |
34 private: | 33 private: |
35 friend class DocumentScanScanFunctionTest; | 34 friend class DocumentScanScanFunctionTest; |
36 | 35 |
37 void OnScannerListReceived( | 36 void OnScannerListReceived( |
38 const std::vector<DocumentScanInterface::ScannerDescription>& | 37 const std::vector<DocumentScanInterface::ScannerDescription>& |
39 scanner_descriptions, | 38 scanner_descriptions, |
40 const std::string& error); | 39 const std::string& error); |
41 void OnResultsReceived(const std::string& scanned_image, | 40 void OnResultsReceived(const std::string& scanned_image, |
42 const std::string& mime_type, | 41 const std::string& mime_type, |
43 const std::string& error); | 42 const std::string& error); |
44 | 43 |
45 scoped_ptr<document_scan::Scan::Params> params_; | 44 scoped_ptr<document_scan::Scan::Params> params_; |
46 scoped_ptr<DocumentScanInterface> document_scan_interface_; | 45 scoped_ptr<DocumentScanInterface> document_scan_interface_; |
47 | 46 |
48 DISALLOW_COPY_AND_ASSIGN(DocumentScanScanFunction); | 47 DISALLOW_COPY_AND_ASSIGN(DocumentScanScanFunction); |
49 }; | 48 }; |
50 | 49 |
51 } // namespace api | 50 } // namespace core_api |
52 | 51 |
53 } // namespace extensions | 52 } // namespace extensions |
54 | 53 |
55 #endif // CHROME_BROWSER_EXTENSIONS_API_DOCUMENT_SCAN_DOCUMENT_SCAN_API_H_ | 54 #endif // EXTENSIONS_BROWSER_API_DOCUMENT_SCAN_DOCUMENT_SCAN_API_H_ |
OLD | NEW |