OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 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_BIOD_BIOD_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_BIOD_BIOD_CLIENT_H_ |
6 #define CHROMEOS_DBUS_BIOD_BIOD_CLIENT_H_ | 6 #define CHROMEOS_DBUS_BIOD_BIOD_CLIENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <unordered_map> | 9 #include <unordered_map> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
15 #include "chromeos/chromeos_export.h" | 15 #include "chromeos/chromeos_export.h" |
16 #include "chromeos/dbus/biod/constants.pb.h" | |
16 #include "chromeos/dbus/dbus_client.h" | 17 #include "chromeos/dbus/dbus_client.h" |
17 #include "chromeos/dbus/dbus_client_implementation_type.h" | 18 #include "chromeos/dbus/dbus_client_implementation_type.h" |
18 #include "chromeos/dbus/dbus_method_call_status.h" | 19 #include "chromeos/dbus/dbus_method_call_status.h" |
19 #include "third_party/cros_system_api/dbus/service_constants.h" | 20 #include "third_party/cros_system_api/dbus/service_constants.h" |
20 | 21 |
21 namespace chromeos { | 22 namespace chromeos { |
22 | 23 |
23 // Each time the sensor detects a scan, an object containing all the users, each | 24 // Each time the sensor detects a scan, an object containing all the users, each |
24 // with the object paths of all the matched stored biometrics is returned. The | 25 // with the object paths of all the matched stored biometrics is returned. The |
25 // users are unique identifiers which are assigned by Chrome. The object path | 26 // users are unique identifiers which are assigned by Chrome. The object path |
26 // represent the object path of the biometric. | 27 // represent the object path of the biometric. |
27 using AuthScanMatches = | 28 using AuthScanMatches = |
28 std::unordered_map<std::string, std::vector<dbus::ObjectPath>>; | 29 std::unordered_map<std::string, std::vector<dbus::ObjectPath>>; |
29 | 30 |
30 // BiodClient is used to communicate with a biod D-Bus manager | 31 // BiodClient is used to communicate with a biod D-Bus manager |
31 // interface. | 32 // interface. |
32 class CHROMEOS_EXPORT BiodClient : public DBusClient { | 33 class CHROMEOS_EXPORT BiodClient : public DBusClient { |
33 public: | 34 public: |
34 // Interface for observing changes from the biometrics manager. | 35 // Interface for observing changes from the biometrics manager. |
35 class Observer { | 36 class Observer { |
36 public: | 37 public: |
37 // Called when biometrics manager powers up or is restarted. | 38 // Called when biometrics manager powers up or is restarted. |
38 virtual void BiodServiceRestarted() {} | 39 virtual void BiodServiceRestarted() {} |
39 | 40 |
40 // Called whenever a user attempts a scan during enrollment. |scan_result| | 41 // Called whenever a user attempts a scan during enrollment. |scan_result| |
41 // tells whether the scan was succesful. |enroll_session_complete| tells | 42 // tells whether the scan was succesful. |enroll_session_complete| tells |
42 // whether enroll session is complete and is now over. | 43 // whether enroll session is complete and is now over. |
44 // |percent_complete| within [0, 100] represents the percent of enrollment | |
45 // completion and -1 means unknown percentage. | |
43 virtual void BiodEnrollScanDoneReceived(biod::ScanResult scan_result, | 46 virtual void BiodEnrollScanDoneReceived(biod::ScanResult scan_result, |
44 bool enroll_session_complete) {} | 47 bool enroll_session_complete, |
48 int32_t percent_complete) {} | |
Daniel Erat
2017/05/03 20:47:34
just use int
xiaoyinh(OOO Sep 11-29)
2017/05/04 00:29:51
Changed here and other places. Except mojom file d
Daniel Erat
2017/05/04 03:07:11
yeah, i just meant in c++ code.
| |
45 | 49 |
46 // Called when an authentication scan is performed. If the scan is | 50 // Called when an authentication scan is performed. If the scan is |
47 // successful, |matches| will equal all the enrollment IDs that match the | 51 // successful, |matches| will equal all the enrollment IDs that match the |
48 // scan, and the labels of the matched fingeprints. | 52 // scan, and the labels of the matched fingeprints. |
49 virtual void BiodAuthScanDoneReceived(biod::ScanResult scan_result, | 53 virtual void BiodAuthScanDoneReceived(biod::ScanResult scan_result, |
50 const AuthScanMatches& matches) {} | 54 const AuthScanMatches& matches) {} |
51 | 55 |
52 // Called during an enrollment or authentication session to indicate a | 56 // Called during an enrollment or authentication session to indicate a |
53 // failure. Any enrollment that was underway is thrown away and auth will | 57 // failure. Any enrollment that was underway is thrown away and auth will |
54 // no longer be happening. | 58 // no longer be happening. |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 // Create() should be used instead. | 145 // Create() should be used instead. |
142 BiodClient(); | 146 BiodClient(); |
143 | 147 |
144 private: | 148 private: |
145 DISALLOW_COPY_AND_ASSIGN(BiodClient); | 149 DISALLOW_COPY_AND_ASSIGN(BiodClient); |
146 }; | 150 }; |
147 | 151 |
148 } // namespace chromeos | 152 } // namespace chromeos |
149 | 153 |
150 #endif // CHROMEOS_DBUS_BIOD_BIOD_CLIENT_H_ | 154 #endif // CHROMEOS_DBUS_BIOD_BIOD_CLIENT_H_ |
OLD | NEW |