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

Side by Side Diff: chromeos/dbus/biod/biod_client.h

Issue 2567813002: cros: DBUS client to interact with fingerprint DBUS API. (Closed)
Patch Set: s/BiodBiometricsManagerClient/BiodClient Created 3 years, 8 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
(Empty)
1 // Copyright 2017 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.
4
5 #ifndef CHROMEOS_DBUS_BIOD_BIOD_CLIENT_H_
6 #define CHROMEOS_DBUS_BIOD_BIOD_CLIENT_H_
7
8 #include <stdint.h>
Daniel Erat 2017/03/31 04:30:09 are you actually using this?
sammiequon 2017/03/31 22:52:13 Nope. That was for when the scan results were uint
9
Daniel Erat 2017/03/31 04:30:10 #include <string>
sammiequon 2017/03/31 22:52:12 Done.
10 #include <unordered_map>
11 #include <vector>
12
13 #include "base/callback.h"
14 #include "base/macros.h"
15 #include "base/observer_list.h"
16 #include "chromeos/chromeos_export.h"
17 #include "chromeos/dbus/dbus_client.h"
18 #include "chromeos/dbus/dbus_client_implementation_type.h"
19 #include "chromeos/dbus/dbus_method_call_status.h"
20 #include "third_party/cros_system_api/dbus/service_constants.h"
21
22 namespace chromeos {
23
24 // Each time the sensor detects a scan, an object containing all the users, each
25 // with the labels of all the matched stored fingerprints is returned.
Daniel Erat 2017/03/31 04:30:10 please go into more details about the actual value
sammiequon 2017/03/31 22:52:12 Theres another ongoing discussion (not involving m
Daniel Erat 2017/04/01 00:46:26 i think it's okay to document it as being assigned
sammiequon 2017/04/01 01:22:43 Acknowledged.
26 using AuthScanMatches =
27 std::unordered_map<std::string, std::vector<std::string>>;
28
29 // BiodClient is used to communicate with a biod D-Bus manager
30 // interface.
31 class CHROMEOS_EXPORT BiodClient : public DBusClient {
32 public:
33 // Interface for observing changes from the biometrics manager.
34 class Observer {
35 public:
36 // Called when biometrics manager powers up or is restarted.
Daniel Erat 2017/03/31 04:30:10 does this actually get called if biod is already r
sammiequon 2017/03/31 22:52:13 Let me quickly test this out and I'll get back to
sammiequon 2017/04/01 01:22:43 Yeah it gets called when biod is already running a
37 virtual void BiodServiceRestarted() {}
38
39 // Called whenever a user attempts a scan. |scan_result| tells whether the
Daniel Erat 2017/03/31 04:30:10 Called whenever a user attempts a scan during enro
sammiequon 2017/03/31 22:52:12 Done.
40 // scan was succesful. |enroll_session_complete| tells whether enroll
41 // session is complete and is now over.
42 virtual void BiodEnrollScanDoneReceived(biod::ScanResult scan_result,
43 bool enroll_session_complete) {}
44
45 // Called to indicate a bad scan of any kind, or a successful scan. If scan
Daniel Erat 2017/03/31 04:30:09 Called when an authentication scan is performed.
sammiequon 2017/03/31 22:52:12 Done.
46 // is successful, |matches| will equal all the enrollment IDs that match the
47 // scan, and the labels of the matched fingeprints.
48 virtual void BiodAuthScanDoneReceived(biod::ScanResult scan_result,
49 const AuthScanMatches& matches) {}
50
51 // Called during either session to indicate a failure. Any enrollment that
Daniel Erat 2017/03/31 04:30:10 s/either session/an enrollment or authentication s
sammiequon 2017/03/31 22:52:12 Done.
52 // was underway is thrown away and auth will no longer be happening.
53 virtual void BiodSessionFailedReceived() {}
54
55 protected:
56 virtual ~Observer() {}
57 };
58
59 ~BiodClient() override;
60
61 // Adds and removes the observer.
62 virtual void AddObserver(Observer* observer) = 0;
63 virtual void RemoveObserver(Observer* observer) = 0;
64
65 // Returns true if this object has the given observer.
66 virtual bool HasObserver(const Observer* observer) const = 0;
67
68 // UserRecordsCallback is used for the GetRecordsForUser method. It receives
69 // one argument which contains a list of the stored records object paths for
Daniel Erat 2017/03/31 04:30:10 s/records/records'/
sammiequon 2017/03/31 22:52:12 Done.
70 // a given user.
71 using UserRecordsCallback =
72 base::Callback<void(const std::vector<dbus::ObjectPath>&)>;
73
74 // BiometricTypeCallback is used for the GetType method. It receives
75 // one argument which states the type of biometric.
76 using BiometricTypeCallback = base::Callback<void(biod::BiometricType)>;
77
78 // Starts the biometric enroll session. |callback| is called with the object
79 // path of the current enroll session after the method succeeds.
80 virtual void StartEnrollSession(const std::string& user_id,
Daniel Erat 2017/03/31 04:30:10 same comment re |user_id|, also document what |lab
sammiequon 2017/03/31 22:52:12 Done.
81 const std::string& label,
82 const ObjectPathCallback& callback) = 0;
83
84 // Gets all the records registered with this biometric. |callback| is called
Daniel Erat 2017/03/31 04:30:09 do you mean "... with this user"?
sammiequon 2017/03/31 22:52:12 Done.
85 // with all the object paths of the records after this method succeeds.
86 virtual void GetRecordsForUser(const std::string& user_id,
Daniel Erat 2017/03/31 04:30:10 as above, document what the id actually is and ide
sammiequon 2017/03/31 22:52:13 Done.
87 const UserRecordsCallback& callback) = 0;
88
89 // Irreversibly destroys all records registered with this biometric.
Daniel Erat 2017/03/31 04:30:09 should you drop text like "with this biometric" if
sammiequon 2017/03/31 22:52:12 Done.
90 virtual void DestroyAllRecords() = 0;
91
92 // Starts the biometric auth session. |callback| is called with the object
93 // path of the auth session after the method succeeds.
94 virtual void StartAuthSession(const ObjectPathCallback& callback) = 0;
95
96 // Requests the type of biometric. |callback| is called with the biometric
97 // type after the method succeeds.
98 virtual void RequestType(const BiometricTypeCallback& callback) = 0;
99
100 // Creates the instance.
101 static BiodClient* Create(DBusClientImplementationType type);
102
103 protected:
104 friend class BiodClientTest;
105
106 // Create() should be used instead.
107 BiodClient();
108
109 private:
110 DISALLOW_COPY_AND_ASSIGN(BiodClient);
111 };
112
113 } // namespace chromeos
114
115 #endif // CHROMEOS_DBUS_BIOD_BIOD_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698