Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1242)

Side by Side Diff: chromeos/dbus/lorgnette_manager_client.h

Issue 2299143002: chromeos: Remove dbus::FileDescriptor from LorgnetteManagerClient (Closed)
Patch Set: Update comment Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROMEOS_DBUS_LORGNETTE_MANAGER_CLIENT_H_ 5 #ifndef CHROMEOS_DBUS_LORGNETTE_MANAGER_CLIENT_H_
6 #define CHROMEOS_DBUS_LORGNETTE_MANAGER_CLIENT_H_ 6 #define CHROMEOS_DBUS_LORGNETTE_MANAGER_CLIENT_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string>
9 10
10 #include "base/callback.h" 11 #include "base/callback.h"
11 #include "base/files/file.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ref_counted_memory.h"
14 #include "chromeos/chromeos_export.h" 13 #include "chromeos/chromeos_export.h"
15 #include "chromeos/dbus/dbus_client.h" 14 #include "chromeos/dbus/dbus_client.h"
16 15
17 namespace chromeos { 16 namespace chromeos {
18 17
19 // LorgnetteManagerClient is used to communicate with the lorgnette 18 // LorgnetteManagerClient is used to communicate with the lorgnette
20 // document scanning daemon. 19 // document scanning daemon.
21 class CHROMEOS_EXPORT LorgnetteManagerClient : public DBusClient { 20 class CHROMEOS_EXPORT LorgnetteManagerClient : public DBusClient {
22 public: 21 public:
23 // The property information for each scanner retured by ListScanners. 22 // The property information for each scanner retured by ListScanners.
24 typedef std::map<std::string, std::string> ScannerTableEntry; 23 typedef std::map<std::string, std::string> ScannerTableEntry;
25 typedef std::map<std::string, ScannerTableEntry> ScannerTable; 24 typedef std::map<std::string, ScannerTableEntry> ScannerTable;
26 25
27 // Callback type for ListScanners(). Returns a map which contains 26 // Callback type for ListScanners(). Returns a map which contains
28 // a ScannerTableEntry for each available scanner. 27 // a ScannerTableEntry for each available scanner.
29 typedef base::Callback<void( 28 typedef base::Callback<void(
30 bool succeeded, const ScannerTable&)> ListScannersCallback; 29 bool succeeded, const ScannerTable&)> ListScannersCallback;
31 30
32 // Called once ScanImageToFile() is complete. Takes one parameter:
33 // - succeeded: was the scan completed successfully.
34 typedef base::Callback<void(bool succeeded)> ScanImageToFileCallback;
35
36 // Called once ScanImageToString() is complete. Takes two parameters: 31 // Called once ScanImageToString() is complete. Takes two parameters:
37 // - succeeded: was the scan completed successfully. 32 // - succeeded: was the scan completed successfully.
38 // - image_data: the contents of the image. 33 // - image_data: the contents of the image.
39 typedef base::Callback<void( 34 typedef base::Callback<void(
40 bool succeeded, 35 bool succeeded,
41 const std::string& image_data)> ScanImageToStringCallback; 36 const std::string& image_data)> ScanImageToStringCallback;
42 37
43 // Attributes provided to a scan request. 38 // Attributes provided to a scan request.
44 struct ScanProperties { 39 struct ScanProperties {
45 ScanProperties() : resolution_dpi(0) {} 40 ScanProperties() : resolution_dpi(0) {}
46 std::string mode; // Can be "Color", "Gray", or "Lineart". 41 std::string mode; // Can be "Color", "Gray", or "Lineart".
47 int resolution_dpi; 42 int resolution_dpi;
48 }; 43 };
49 44
50 ~LorgnetteManagerClient() override; 45 ~LorgnetteManagerClient() override;
51 46
52 // Gets a list of scanners from the lorgnette manager. 47 // Gets a list of scanners from the lorgnette manager.
53 virtual void ListScanners(const ListScannersCallback& callback) = 0; 48 virtual void ListScanners(const ListScannersCallback& callback) = 0;
54 49
55 // Request a scanned image to be scanned to |file| and calls |callback|
56 // when completed. Image data will be stored in the .png format.
57 virtual void ScanImageToFile(std::string device_name,
58 const ScanProperties& properties,
59 const ScanImageToFileCallback& callback,
60 base::File* file) = 0;
61
62 // Request a scanned image and calls |callback| when completed with a string 50 // Request a scanned image and calls |callback| when completed with a string
63 // pointing at the scanned image data. Image data will be stored in the .png 51 // pointing at the scanned image data. Image data will be stored in the .png
64 // format. 52 // format.
65 virtual void ScanImageToString(std::string device_name, 53 virtual void ScanImageToString(std::string device_name,
66 const ScanProperties& properties, 54 const ScanProperties& properties,
67 const ScanImageToStringCallback& callback) = 0; 55 const ScanImageToStringCallback& callback) = 0;
68 56
69 // Factory function, creates a new instance and returns ownership. 57 // Factory function, creates a new instance and returns ownership.
70 // For normal usage, access the singleton via DBusThreadManager::Get(). 58 // For normal usage, access the singleton via DBusThreadManager::Get().
71 static LorgnetteManagerClient* Create(); 59 static LorgnetteManagerClient* Create();
72 60
73 protected: 61 protected:
74 // Create() should be used instead. 62 // Create() should be used instead.
75 LorgnetteManagerClient(); 63 LorgnetteManagerClient();
76 64
77 private: 65 private:
78 DISALLOW_COPY_AND_ASSIGN(LorgnetteManagerClient); 66 DISALLOW_COPY_AND_ASSIGN(LorgnetteManagerClient);
79 }; 67 };
80 68
81 } // namespace chromeos 69 } // namespace chromeos
82 70
83 #endif // CHROMEOS_DBUS_LORGNETTE_MANAGER_CLIENT_H_ 71 #endif // CHROMEOS_DBUS_LORGNETTE_MANAGER_CLIENT_H_
OLDNEW
« no previous file with comments | « chromeos/dbus/fake_lorgnette_manager_client.cc ('k') | chromeos/dbus/lorgnette_manager_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698