Chromium Code Reviews

Side by Side Diff: chrome/browser/extensions/api/document_scan/document_scan_api.h

Issue 286933006: Implement a JavaScript API for document scanning (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added entries to histograms.xml, clarified comments Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
(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 #include "chrome/common/extensions/api/document_scan.h"
6 #include "chromeos/dbus/lorgnette_manager_client.h"
7 #include "extensions/browser/api/async_api_function.h"
8
9 #ifndef CHROME_BROWSER_EXTENSIONS_API_DOCUMENT_SCAN_DOCUMENT_SCAN_API_H_
10 #define CHROME_BROWSER_EXTENSIONS_API_DOCUMENT_SCAN_DOCUMENT_SCAN_API_H_
11
12 namespace base {
13 class FilePath;
14 } // namespace base
15
16 namespace extensions {
17
18 namespace api {
19
20 class DocumentScanListScannersFunction : public AsyncApiFunction {
21 public:
22 DECLARE_EXTENSION_FUNCTION("documentScan.listScanners",
23 DOCUMENT_SCAN_LISTSCANNERS)
24 DocumentScanListScannersFunction();
25
26 protected:
27 ~DocumentScanListScannersFunction();
28
29 // AsyncApiFunction:
30 virtual bool Prepare() OVERRIDE;
31 virtual void AsyncWorkStart() OVERRIDE;
32 virtual bool Respond() OVERRIDE;
33
34 private:
35 void OnScannerListReceived(
36 bool succeeded,
37 const chromeos::LorgnetteManagerClient::ScannerTable &scanners);
38 };
39
40 class DocumentScanScanFunction : public AsyncApiFunction {
41 public:
42 DECLARE_EXTENSION_FUNCTION("documentScan.scan",
43 DOCUMENT_SCAN_SCAN)
44 DocumentScanScanFunction();
45
46 protected:
47 ~DocumentScanScanFunction();
48
49 // AsyncApiFunction:
50 virtual bool Prepare() OVERRIDE;
51 virtual void AsyncWorkStart() OVERRIDE;
52 virtual bool Respond() OVERRIDE;
53
54 private:
55 bool GetDocumentScanFilename(base::FilePath* filename);
56 void ScanImageCallback(const base::FilePath &filename, bool succeeded);
57 void FinishScan();
58
59 scoped_ptr<document_scan::Scan::Params> params_;
60 };
61
62 } // namespace api
63
64 } // namespace extensions
65
66 #endif // CHROME_BROWSER_EXTENSIONS_API_DOCUMENT_SCAN_DOCUMENT_SCAN_API_H_
OLDNEW

Powered by Google App Engine