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