Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / extensions / browser / api / document_scan / document_scan_interface.h
blob9b8699d632e9ad5f1115a9bf2507d32ca5584b9a
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 core_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 core_api
57 } // namespace extensions
59 #endif // EXTENSIONS_BROWSER_API_DOCUMENT_SCAN_DOCUMENT_SCAN_INTERFACE_H_