Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / extensions / browser / api / document_scan / document_scan_interface.h
blob3339a1607d489fc6bd64ec8673b3fcc723943bbd
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_INTERFACE_H_
6 #define EXTENSIONS_BROWSER_API_DOCUMENT_SCAN_DOCUMENT_SCAN_INTERFACE_H_
8 #include <string>
9 #include <vector>
11 #include "base/callback.h"
12 #include "base/memory/scoped_ptr.h"
14 namespace extensions {
16 namespace api {
18 class DocumentScanInterface {
19 public:
20 struct ScannerDescription {
21 ScannerDescription();
22 ~ScannerDescription();
23 std::string name;
24 std::string manufacturer;
25 std::string model;
26 std::string scanner_type;
27 std::string image_mime_type;
30 enum ScanMode { kScanModeColor, kScanModeGray, kScanModeLineart };
32 typedef base::Callback<void(
33 const std::vector<ScannerDescription>& scanner_descriptions,
34 const std::string& error)> ListScannersResultsCallback;
36 typedef base::Callback<void(const std::string& scanned_image,
37 const std::string& mime_type,
38 const std::string& error)> ScanResultsCallback;
40 virtual ~DocumentScanInterface();
42 virtual void Scan(const std::string& scanner_name,
43 ScanMode mode,
44 int resolution_dpi,
45 const ScanResultsCallback& callback) = 0;
46 virtual void ListScanners(const ListScannersResultsCallback& callback) = 0;
48 // Creates a platform-specific DocumentScanInterface instance.
49 static DocumentScanInterface* CreateInstance();
51 protected:
52 DocumentScanInterface();
55 } // namespace api
57 } // namespace extensions
59 #endif // EXTENSIONS_BROWSER_API_DOCUMENT_SCAN_DOCUMENT_SCAN_INTERFACE_H_