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> |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // UserRecordsCallback is used for the GetRecordsForUser method. It receives | 70 // UserRecordsCallback is used for the GetRecordsForUser method. It receives |
71 // one argument which contains a list of the stored records' object paths for | 71 // one argument which contains a list of the stored records' object paths for |
72 // a given user. | 72 // a given user. |
73 using UserRecordsCallback = | 73 using UserRecordsCallback = |
74 base::Callback<void(const std::vector<dbus::ObjectPath>&)>; | 74 base::Callback<void(const std::vector<dbus::ObjectPath>&)>; |
75 | 75 |
76 // BiometricTypeCallback is used for the GetType method. It receives | 76 // BiometricTypeCallback is used for the GetType method. It receives |
77 // one argument which states the type of biometric. | 77 // one argument which states the type of biometric. |
78 using BiometricTypeCallback = base::Callback<void(biod::BiometricType)>; | 78 using BiometricTypeCallback = base::Callback<void(biod::BiometricType)>; |
79 | 79 |
| 80 // LabelCallback is for the RequestRecordLabel method. |
| 81 using LabelCallback = base::Callback<void(const std::string& label)>; |
| 82 |
80 // Starts the biometric enroll session. |callback| is called with the object | 83 // Starts the biometric enroll session. |callback| is called with the object |
81 // path of the current enroll session after the method succeeds. |user_id| | 84 // path of the current enroll session after the method succeeds. |user_id| |
82 // contains the unique identifier for the owner of the biometric. |label| is | 85 // contains the unique identifier for the owner of the biometric. |label| is |
83 // the the human readable label the user gave the biometric. | 86 // the the human readable label the user gave the biometric. |
84 virtual void StartEnrollSession(const std::string& user_id, | 87 virtual void StartEnrollSession(const std::string& user_id, |
85 const std::string& label, | 88 const std::string& label, |
86 const ObjectPathCallback& callback) = 0; | 89 const ObjectPathCallback& callback) = 0; |
87 | 90 |
88 // Gets all the records registered with this biometric. |callback| is called | 91 // Gets all the records registered with this biometric. |callback| is called |
89 // with all the object paths of the records with |user_id| after this method | 92 // with all the object paths of the records with |user_id| after this method |
90 // succeeds. |user_id| contains the unique identifier for the owner of the | 93 // succeeds. |user_id| contains the unique identifier for the owner of the |
91 // biometric. | 94 // biometric. |
92 virtual void GetRecordsForUser(const std::string& user_id, | 95 virtual void GetRecordsForUser(const std::string& user_id, |
93 const UserRecordsCallback& callback) = 0; | 96 const UserRecordsCallback& callback) = 0; |
94 | 97 |
95 // Irreversibly destroys all records registered. | 98 // Irreversibly destroys all records registered. |
96 virtual void DestroyAllRecords() = 0; | 99 virtual void DestroyAllRecords() = 0; |
97 | 100 |
98 // Starts the biometric auth session. |callback| is called with the object | 101 // Starts the biometric auth session. |callback| is called with the object |
99 // path of the auth session after the method succeeds. | 102 // path of the auth session after the method succeeds. |
100 virtual void StartAuthSession(const ObjectPathCallback& callback) = 0; | 103 virtual void StartAuthSession(const ObjectPathCallback& callback) = 0; |
101 | 104 |
102 // Requests the type of biometric. |callback| is called with the biometric | 105 // Requests the type of biometric. |callback| is called with the biometric |
103 // type after the method succeeds. | 106 // type after the method succeeds. |
104 virtual void RequestType(const BiometricTypeCallback& callback) = 0; | 107 virtual void RequestType(const BiometricTypeCallback& callback) = 0; |
105 | 108 |
| 109 // Cancels the enroll session at |enroll_session_path|. |
| 110 virtual void CancelEnrollSession( |
| 111 const dbus::ObjectPath& enroll_session_path) = 0; |
| 112 |
| 113 // Ends the auth session at |auth_session_path|. |
| 114 virtual void EndAuthSession(const dbus::ObjectPath& auth_session_path) = 0; |
| 115 |
| 116 // Changes the label of the record at |record_path| to |label|. |
| 117 virtual void SetRecordLabel(const dbus::ObjectPath& record_path, |
| 118 const std::string& label) = 0; |
| 119 |
| 120 // Removes the record at |record_path|. This record will no longer be able to |
| 121 // used for authentication. |
| 122 virtual void RemoveRecord(const dbus::ObjectPath& record_path) = 0; |
| 123 |
| 124 // Requests the label of the record at |record_path|. |callback| is called |
| 125 // with the label of the record. |
| 126 virtual void RequestRecordLabel(const dbus::ObjectPath& record_path, |
| 127 const LabelCallback& callback) = 0; |
| 128 |
106 // Creates the instance. | 129 // Creates the instance. |
107 static BiodClient* Create(DBusClientImplementationType type); | 130 static BiodClient* Create(DBusClientImplementationType type); |
108 | 131 |
109 protected: | 132 protected: |
110 friend class BiodClientTest; | 133 friend class BiodClientTest; |
111 | 134 |
112 // Create() should be used instead. | 135 // Create() should be used instead. |
113 BiodClient(); | 136 BiodClient(); |
114 | 137 |
115 private: | 138 private: |
116 DISALLOW_COPY_AND_ASSIGN(BiodClient); | 139 DISALLOW_COPY_AND_ASSIGN(BiodClient); |
117 }; | 140 }; |
118 | 141 |
119 } // namespace chromeos | 142 } // namespace chromeos |
120 | 143 |
121 #endif // CHROMEOS_DBUS_BIOD_BIOD_CLIENT_H_ | 144 #endif // CHROMEOS_DBUS_BIOD_BIOD_CLIENT_H_ |
OLD | NEW |