OLD | NEW |
(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 SERVICES_DEVICE_FINGERPRINT_FINGERPRINT_IMPL_CHROMEOS_H_ |
| 6 #define SERVICES_DEVICE_FINGERPRINT_FINGERPRINT_IMPL_CHROMEOS_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "services/device/public/interfaces/fingerprint.mojom.h" |
| 12 |
| 13 namespace dbus { |
| 14 class ObjectPath; |
| 15 } |
| 16 |
| 17 namespace device { |
| 18 |
| 19 // Implementation of Fingerprint interface for ChromeOS platform. |
| 20 // This is used to connect to biod(through dbus) and perform fingerprint related |
| 21 // operations. It observes signals from biod. |
| 22 class FingerprintImplChromeOS : public mojom::Fingerprint { |
| 23 public: |
| 24 explicit FingerprintImplChromeOS(); |
| 25 ~FingerprintImplChromeOS() override; |
| 26 |
| 27 // mojom::Fingerprint: |
| 28 void GetFingerprintsList( |
| 29 const GetFingerprintsListCallback& callback) override; |
| 30 void StartEnroll(const std::string& user_id, |
| 31 const std::string& label) override; |
| 32 void CancelCurrentEnroll() override; |
| 33 void GetLabel(int32_t index, const GetLabelCallback& callback) override; |
| 34 void SetLabel(const std::string& label, int32_t index) override; |
| 35 void RemoveEnrollment(int32_t index) override; |
| 36 void StartAuthentication() override; |
| 37 void EndCurrentAuthentication() override; |
| 38 void DestroyAllEnrollments() override; |
| 39 void AddFingerprintObserver(mojom::FingerprintObserverPtr observer) override; |
| 40 |
| 41 private: |
| 42 friend class FingerprintImplChromeOSTest; |
| 43 |
| 44 void BiodBiometricClientRestarted(); |
| 45 void BiometricsScanEventReceived(uint32_t scan_result, bool is_complete); |
| 46 void BiometricsAttemptEventReceived( |
| 47 uint32_t scan_result, |
| 48 const std::vector<std::string>& recognized_user_ids); |
| 49 void BiometricsFailureReceived(); |
| 50 |
| 51 void OnFingerprintObserverDisconnected(mojom::FingerprintObserver* observer); |
| 52 void OnStartEnroll(const dbus::ObjectPath& enroll_path); |
| 53 void OnStartAuthentication(const dbus::ObjectPath& auth_path); |
| 54 void OnGetFingerprintsList( |
| 55 const GetFingerprintsListCallback& callback, |
| 56 const std::vector<dbus::ObjectPath>& enrollment_paths); |
| 57 void OnGetLabelFromEnrollmentPath(const GetFingerprintsListCallback& callback, |
| 58 size_t num_enrollments, |
| 59 std::vector<std::string>* out_labels, |
| 60 const std::string& label); |
| 61 |
| 62 void OnGetLabel(int32_t index, |
| 63 const GetLabelCallback& callback, |
| 64 const std::vector<dbus::ObjectPath>& enrollment_paths); |
| 65 void OnSetLabel(const std::string& new_label, |
| 66 int index, |
| 67 const std::vector<dbus::ObjectPath>& enrollment_paths); |
| 68 void OnRemoveEnrollment( |
| 69 int index, |
| 70 const std::vector<dbus::ObjectPath>& enrollment_paths); |
| 71 |
| 72 std::vector<mojom::FingerprintObserverPtr> observers_; |
| 73 std::unique_ptr<dbus::ObjectPath> current_enroll_path_; |
| 74 std::unique_ptr<dbus::ObjectPath> current_auth_path_; |
| 75 |
| 76 base::WeakPtrFactory<FingerprintImplChromeOS> weak_ptr_factory_; |
| 77 |
| 78 DISALLOW_COPY_AND_ASSIGN(FingerprintImplChromeOS); |
| 79 }; |
| 80 |
| 81 } // namespace device |
| 82 |
| 83 #endif // SERVICES_DEVICE_FINGERPRINT_FINGERPRINT_IMPL_CHROMEOS_H_ |
OLD | NEW |