Chromium Code Reviews| 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 RequestLabel method. It receives one argument | |
|
Daniel Erat
2017/04/03 19:58:18
RequestRecordLabel
sammiequon
2017/04/03 21:35:09
Done.
| |
| 81 // which is the label of the record. | |
| 82 using LabelCallback = base::Callback<void(const std::string&)>; | |
|
Daniel Erat
2017/04/03 19:58:18
i think you can include a parameter name here, e.g
sammiequon
2017/04/03 21:35:09
Done.
| |
| 83 | |
| 80 // Starts the biometric enroll session. |callback| is called with the object | 84 // Starts the biometric enroll session. |callback| is called with the object |
| 81 // path of the current enroll session after the method succeeds. |user_id| | 85 // 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 | 86 // contains the unique identifier for the owner of the biometric. |label| is |
| 83 // the the human readable label the user gave the biometric. | 87 // the the human readable label the user gave the biometric. |
| 84 virtual void StartEnrollSession(const std::string& user_id, | 88 virtual void StartEnrollSession(const std::string& user_id, |
| 85 const std::string& label, | 89 const std::string& label, |
| 86 const ObjectPathCallback& callback) = 0; | 90 const ObjectPathCallback& callback) = 0; |
| 87 | 91 |
| 88 // Gets all the records registered with this biometric. |callback| is called | 92 // 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 | 93 // 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 | 94 // succeeds. |user_id| contains the unique identifier for the owner of the |
| 91 // biometric. | 95 // biometric. |
| 92 virtual void GetRecordsForUser(const std::string& user_id, | 96 virtual void GetRecordsForUser(const std::string& user_id, |
| 93 const UserRecordsCallback& callback) = 0; | 97 const UserRecordsCallback& callback) = 0; |
| 94 | 98 |
| 95 // Irreversibly destroys all records registered. | 99 // Irreversibly destroys all records registered. |
| 96 virtual void DestroyAllRecords() = 0; | 100 virtual void DestroyAllRecords() = 0; |
| 97 | 101 |
| 98 // Starts the biometric auth session. |callback| is called with the object | 102 // Starts the biometric auth session. |callback| is called with the object |
| 99 // path of the auth session after the method succeeds. | 103 // path of the auth session after the method succeeds. |
| 100 virtual void StartAuthSession(const ObjectPathCallback& callback) = 0; | 104 virtual void StartAuthSession(const ObjectPathCallback& callback) = 0; |
| 101 | 105 |
| 102 // Requests the type of biometric. |callback| is called with the biometric | 106 // Requests the type of biometric. |callback| is called with the biometric |
| 103 // type after the method succeeds. | 107 // type after the method succeeds. |
| 104 virtual void RequestType(const BiometricTypeCallback& callback) = 0; | 108 virtual void RequestType(const BiometricTypeCallback& callback) = 0; |
| 105 | 109 |
| 110 // Cancels the enroll session at |enroll_session_path|. | |
| 111 virtual void CancelEnrollSession( | |
| 112 const dbus::ObjectPath& enroll_session_path) = 0; | |
| 113 | |
| 114 // Ends the auth session at |auth_session_path|. | |
| 115 virtual void EndAuthSession(const dbus::ObjectPath& auth_session_path) = 0; | |
| 116 | |
| 117 // Changes the label of the record at |record_path| to |label|. | |
| 118 virtual void SetRecordLabel(const dbus::ObjectPath& record_path, | |
| 119 const std::string& label) = 0; | |
| 120 | |
| 121 // Removes the record at |record_path|. This record will no longer be able to | |
| 122 // used for authentication. | |
| 123 virtual void RemoveRecord(const dbus::ObjectPath& record_path) = 0; | |
| 124 | |
| 125 // Requests the label of the record at |record_path|. |callback| is called | |
| 126 // with the label of the record. | |
| 127 virtual void RequestRecordLabel(const dbus::ObjectPath& record_path, | |
| 128 const LabelCallback& callback) = 0; | |
| 129 | |
| 106 // Creates the instance. | 130 // Creates the instance. |
| 107 static BiodClient* Create(DBusClientImplementationType type); | 131 static BiodClient* Create(DBusClientImplementationType type); |
| 108 | 132 |
| 109 protected: | 133 protected: |
| 110 friend class BiodClientTest; | 134 friend class BiodClientTest; |
| 111 | 135 |
| 112 // Create() should be used instead. | 136 // Create() should be used instead. |
| 113 BiodClient(); | 137 BiodClient(); |
| 114 | 138 |
| 115 private: | 139 private: |
| 116 DISALLOW_COPY_AND_ASSIGN(BiodClient); | 140 DISALLOW_COPY_AND_ASSIGN(BiodClient); |
| 117 }; | 141 }; |
| 118 | 142 |
| 119 } // namespace chromeos | 143 } // namespace chromeos |
| 120 | 144 |
| 121 #endif // CHROMEOS_DBUS_BIOD_BIOD_CLIENT_H_ | 145 #endif // CHROMEOS_DBUS_BIOD_BIOD_CLIENT_H_ |
| OLD | NEW |