OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 #include "device/fingerprint/fingerprint_impl.h" |
| 6 |
| 7 #include <string.h> |
| 8 |
| 9 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 10 |
| 11 namespace device { |
| 12 |
| 13 FingerprintImpl::FingerprintImpl() : weak_ptr_factory_(this) {} |
| 14 |
| 15 FingerprintImpl::~FingerprintImpl() {} |
| 16 |
| 17 // static |
| 18 void FingerprintImpl::Create(device::mojom::FingerprintRequest request) { |
| 19 mojo::MakeStrongBinding(base::MakeUnique<FingerprintImpl>(), |
| 20 std::move(request)); |
| 21 } |
| 22 |
| 23 void FingerprintImpl::GetFingerprintsList( |
| 24 const GetFingerprintsListCallback& callback) {} |
| 25 |
| 26 void FingerprintImpl::StartEnroll(const std::string& user_id, |
| 27 const std::string& label) {} |
| 28 |
| 29 void FingerprintImpl::CancelCurrentEnroll() { |
| 30 // Call Dbus to canel current enroll and reset the current_enroll_path. |
| 31 current_enroll_path_.reset(); |
| 32 } |
| 33 |
| 34 void FingerprintImpl::GetLabel(int32_t index, |
| 35 const GetLabelCallback& callback) {} |
| 36 |
| 37 void FingerprintImpl::SetLabel(const std::string& label, int32_t index) {} |
| 38 |
| 39 void FingerprintImpl::RemoveEnrollment(int32_t index) {} |
| 40 |
| 41 void FingerprintImpl::StartAuthentication() {} |
| 42 |
| 43 void FingerprintImpl::EndCurrentAuthentication() { |
| 44 // Call Dbus to canel current authentication and reset the current_auth_path. |
| 45 current_auth_path_.reset(); |
| 46 } |
| 47 |
| 48 void FingerprintImpl::DestroyAllEnrollments() {} |
| 49 |
| 50 void FingerprintImpl::AddBiodObserver(mojom::BiodObserverPtr observer) { |
| 51 observer.set_connection_error_handler( |
| 52 base::Bind(&FingerprintImpl::OnBiodObserverDisconnected, |
| 53 base::Unretained(this), observer.get())); |
| 54 observers_.push_back(std::move(observer)); |
| 55 } |
| 56 |
| 57 void FingerprintImpl::OnBiodObserverDisconnected( |
| 58 mojom::BiodObserver* observer) { |
| 59 for (auto item = observers_.begin(); item != observers_.end(); ++item) { |
| 60 if (item->get() == observer) { |
| 61 observers_.erase(item); |
| 62 break; |
| 63 } |
| 64 } |
| 65 } |
| 66 |
| 67 void FingerprintImpl::OnStartEnroll(const dbus::ObjectPath& enroll_path) { |
| 68 DCHECK(!current_enroll_path_); |
| 69 current_enroll_path_ = base::MakeUnique<dbus::ObjectPath>(enroll_path); |
| 70 } |
| 71 |
| 72 void FingerprintImpl::OnStartAuthentication(const dbus::ObjectPath& auth_path) { |
| 73 DCHECK(!current_auth_path_); |
| 74 current_auth_path_ = base::MakeUnique<dbus::ObjectPath>(auth_path); |
| 75 } |
| 76 |
| 77 void FingerprintImpl::OnGetFingerprintsList( |
| 78 const GetFingerprintsListCallback& callback, |
| 79 const std::vector<dbus::ObjectPath>& enrollment_paths) {} |
| 80 |
| 81 void FingerprintImpl::OnGetLabel( |
| 82 int32_t index, |
| 83 const GetLabelCallback& callback, |
| 84 const std::vector<dbus::ObjectPath>& enrollment_paths) { |
| 85 DCHECK(index >= 0 && index < int{enrollment_paths.size()}); |
| 86 } |
| 87 |
| 88 void FingerprintImpl::OnSetLabel( |
| 89 const std::string& new_label, |
| 90 int index, |
| 91 const std::vector<dbus::ObjectPath>& enrollment_paths) { |
| 92 DCHECK(index >= 0 && index < int{enrollment_paths.size()}); |
| 93 } |
| 94 |
| 95 void FingerprintImpl::OnRemoveEnrollment( |
| 96 int index, |
| 97 const std::vector<dbus::ObjectPath>& enrollment_paths) { |
| 98 DCHECK(index >= 0 && index < int{enrollment_paths.size()}); |
| 99 } |
| 100 |
| 101 } // namespace device |
OLD | NEW |