QUIC - Record reject reasons for CHLO message.
[chromium-blink-merge.git] / chromeos / dbus / lorgnette_manager_client.h
blobd5ecd4addb7a87149f496d32277bf3bad5634d8f
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 CHROMEOS_DBUS_LORGNETTE_MANAGER_CLIENT_H_
6 #define CHROMEOS_DBUS_LORGNETTE_MANAGER_CLIENT_H_
8 #include <map>
10 #include "base/callback.h"
11 #include "base/files/file.h"
12 #include "base/memory/ref_counted_memory.h"
13 #include "chromeos/chromeos_export.h"
14 #include "chromeos/dbus/dbus_client.h"
16 namespace chromeos {
18 // LorgnetteManagerClient is used to communicate with the lorgnette
19 // document scanning daemon.
20 class CHROMEOS_EXPORT LorgnetteManagerClient : public DBusClient {
21 public:
22 // The property information for each scanner retured by ListScanners.
23 typedef std::map<std::string, std::string> ScannerTableEntry;
24 typedef std::map<std::string, ScannerTableEntry> ScannerTable;
26 // Callback type for ListScanners(). Returns a map which contains
27 // a ScannerTableEntry for each available scanner.
28 typedef base::Callback<void(
29 bool succeeded, const ScannerTable&)> ListScannersCallback;
31 // Called once ScanImage() is complete. Takes one parameter:
32 // - succeeded: was the scan completed successfully.
33 typedef base::Callback<void(bool succeeded)> ScanImageCallback;
35 // Attributes provided to a scan request.
36 struct ScanProperties {
37 ScanProperties() : resolution_dpi(0) {}
38 std::string mode; // Can be "Color", "Gray", or "Lineart".
39 int resolution_dpi;
42 virtual ~LorgnetteManagerClient();
44 // Gets a list of scanners from the lorgnette manager.
45 virtual void ListScanners(const ListScannersCallback& callback) = 0;
47 // Request a scanned image and calls |callback| when completed.
48 // Image data will be stored in the .png format.
49 virtual void ScanImage(std::string device_name,
50 base::PlatformFile file,
51 const ScanProperties& properties,
52 const ScanImageCallback& callback) = 0;
54 // Factory function, creates a new instance and returns ownership.
55 // For normal usage, access the singleton via DBusThreadManager::Get().
56 static LorgnetteManagerClient* Create();
58 protected:
59 // Create() should be used instead.
60 LorgnetteManagerClient();
62 private:
63 DISALLOW_COPY_AND_ASSIGN(LorgnetteManagerClient);
66 } // namespace chromeos
68 #endif // CHROMEOS_DBUS_LORGNETTE_MANAGER_CLIENT_H_