Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: chromeos/dbus/biod/fake_biod_client.cc

Issue 2858003002: Roll src/third_party/cros_system_api/ c6eab9e4d..6139ae009 + API change (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "chromeos/dbus/biod/fake_biod_client.h" 5 #include "chromeos/dbus/biod/fake_biod_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 26 matching lines...) Expand all
37 // were "pressed" during the enroll session. 37 // were "pressed" during the enroll session.
38 std::vector<std::string> fake_fingerprint; 38 std::vector<std::string> fake_fingerprint;
39 }; 39 };
40 40
41 FakeBiodClient::FakeBiodClient() {} 41 FakeBiodClient::FakeBiodClient() {}
42 42
43 FakeBiodClient::~FakeBiodClient() {} 43 FakeBiodClient::~FakeBiodClient() {}
44 44
45 void FakeBiodClient::SendEnrollScanDone(const std::string& fingerprint, 45 void FakeBiodClient::SendEnrollScanDone(const std::string& fingerprint,
46 biod::ScanResult type_result, 46 biod::ScanResult type_result,
47 bool is_complete) { 47 bool is_complete,
48 int32_t percent_complete) {
48 // Enroll scan signals do nothing if an enroll session is not happening. 49 // Enroll scan signals do nothing if an enroll session is not happening.
49 if (current_session_ != FingerprintSession::ENROLL) 50 if (current_session_ != FingerprintSession::ENROLL)
50 return; 51 return;
51 52
52 DCHECK(current_record_); 53 DCHECK(current_record_);
53 // The fake fingerprint gets appended to the current fake fingerprints. 54 // The fake fingerprint gets appended to the current fake fingerprints.
54 current_record_->fake_fingerprint.push_back(fingerprint); 55 current_record_->fake_fingerprint.push_back(fingerprint);
55 56
56 // If the enroll is complete, save the record and exit enroll mode. 57 // If the enroll is complete, save the record and exit enroll mode.
57 if (is_complete) { 58 if (is_complete) {
58 records_[current_record_path_] = std::move(current_record_); 59 records_[current_record_path_] = std::move(current_record_);
59 current_record_path_ = dbus::ObjectPath(); 60 current_record_path_ = dbus::ObjectPath();
60 current_record_.reset(); 61 current_record_.reset();
61 current_session_ = FingerprintSession::NONE; 62 current_session_ = FingerprintSession::NONE;
62 } 63 }
63 64
64 for (auto& observer : observers_) 65 for (auto& observer : observers_)
65 observer.BiodEnrollScanDoneReceived(type_result, is_complete); 66 observer.BiodEnrollScanDoneReceived(type_result, is_complete,
67 percent_complete);
66 } 68 }
67 69
68 void FakeBiodClient::SendAuthScanDone(const std::string& fingerprint, 70 void FakeBiodClient::SendAuthScanDone(const std::string& fingerprint,
69 biod::ScanResult type_result) { 71 biod::ScanResult type_result) {
70 // Auth scan signals do nothing if an auth session is not happening. 72 // Auth scan signals do nothing if an auth session is not happening.
71 if (current_session_ != FingerprintSession::AUTH) 73 if (current_session_ != FingerprintSession::AUTH)
72 return; 74 return;
73 75
74 AuthScanMatches matches; 76 AuthScanMatches matches;
75 // Iterate through all the records to check if fingerprint is a match and 77 // Iterate through all the records to check if fingerprint is a match and
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 const LabelCallback& callback) { 218 const LabelCallback& callback) {
217 std::string record_label; 219 std::string record_label;
218 if (records_.find(record_path) != records_.end()) 220 if (records_.find(record_path) != records_.end())
219 record_label = records_[record_path]->label; 221 record_label = records_[record_path]->label;
220 222
221 base::ThreadTaskRunnerHandle::Get()->PostTask( 223 base::ThreadTaskRunnerHandle::Get()->PostTask(
222 FROM_HERE, base::Bind(callback, record_label)); 224 FROM_HERE, base::Bind(callback, record_label));
223 } 225 }
224 226
225 } // namespace chromeos 227 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698