summaryrefslogtreecommitdiffstats
path: root/extensions/browser/api/document_scan/document_scan_interface_chromeos.h
blob: cd50d508f4ae674ddd85936f4ca11b08d89ed7d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef EXTENSIONS_BROWSER_API_DOCUMENT_SCAN_DOCUMENT_SCAN_INTERFACE_CHROMEOS_H_
#define EXTENSIONS_BROWSER_API_DOCUMENT_SCAN_DOCUMENT_SCAN_INTERFACE_CHROMEOS_H_

#include "extensions/browser/api/document_scan/document_scan_interface.h"
#include "chromeos/dbus/lorgnette_manager_client.h"

namespace extensions {

namespace core_api {

class DocumentScanInterfaceChromeos : public DocumentScanInterface {
 public:
  DocumentScanInterfaceChromeos();
  ~DocumentScanInterfaceChromeos() override;

  void ListScanners(const ListScannersResultsCallback& callback) override;
  void Scan(const std::string& scanner_name,
            ScanMode mode,
            int resolution_dpi,
            const ScanResultsCallback& callback) override;

 private:
  friend class DocumentScanInterfaceChromeosTest;

  void OnScannerListReceived(
      const ListScannersResultsCallback& callback,
      bool succeeded,
      const chromeos::LorgnetteManagerClient::ScannerTable& scanners);
  void OnScanCompleted(const ScanResultsCallback& callback,
                       bool succeeded,
                       const std::string& image_data);
  chromeos::LorgnetteManagerClient* GetLorgnetteManagerClient();

  // Guaranteed to outlive |this|.
  chromeos::LorgnetteManagerClient* lorgnette_manager_client_;

  DISALLOW_COPY_AND_ASSIGN(DocumentScanInterfaceChromeos);
};

}  // namespace core_api

}  // namespace extensions

#endif  // EXTENSIONS_BROWSER_API_DOCUMENT_SCAN_DOCUMENT_SCAN_INTERFACE_CHROMEOS_H_