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 #include "chrome/browser/ui/webui/settings/chromeos/fingerprint_handler.h" | 5 #include "chrome/browser/ui/webui/settings/chromeos/fingerprint_handler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 } | 106 } |
107 | 107 |
108 void FingerprintHandler::HandleGetNumFingerprints(const base::ListValue* args) { | 108 void FingerprintHandler::HandleGetNumFingerprints(const base::ListValue* args) { |
109 AllowJavascript(); | 109 AllowJavascript(); |
110 | 110 |
111 CHECK_EQ(1U, args->GetSize()); | 111 CHECK_EQ(1U, args->GetSize()); |
112 std::string callback_id; | 112 std::string callback_id; |
113 CHECK(args->GetString(0, &callback_id)); | 113 CHECK(args->GetString(0, &callback_id)); |
114 | 114 |
115 ResolveJavascriptCallback(base::StringValue(callback_id), | 115 ResolveJavascriptCallback(base::StringValue(callback_id), |
116 base::FundamentalValue( | 116 base::Value(int{fingerprints_list_.size()})); |
117 int{fingerprints_list_.size()})); | |
118 } | 117 } |
119 | 118 |
120 void FingerprintHandler::HandleStartEnroll(const base::ListValue* args) { | 119 void FingerprintHandler::HandleStartEnroll(const base::ListValue* args) { |
121 } | 120 } |
122 | 121 |
123 void FingerprintHandler::HandleCancelCurrentEnroll( | 122 void FingerprintHandler::HandleCancelCurrentEnroll( |
124 const base::ListValue* args) { | 123 const base::ListValue* args) { |
125 } | 124 } |
126 | 125 |
127 void FingerprintHandler::HandleGetEnrollmentLabel(const base::ListValue* args) { | 126 void FingerprintHandler::HandleGetEnrollmentLabel(const base::ListValue* args) { |
(...skipping 16 matching lines...) Expand all Loading... |
144 CHECK_EQ(2U, args->GetSize()); | 143 CHECK_EQ(2U, args->GetSize()); |
145 std::string callback_id; | 144 std::string callback_id; |
146 int index; | 145 int index; |
147 CHECK(args->GetString(0, &callback_id)); | 146 CHECK(args->GetString(0, &callback_id)); |
148 CHECK(args->GetInteger(1, &index)); | 147 CHECK(args->GetInteger(1, &index)); |
149 | 148 |
150 DCHECK(index < int{fingerprints_list_.size()}); | 149 DCHECK(index < int{fingerprints_list_.size()}); |
151 bool deleteSucessful = true; | 150 bool deleteSucessful = true; |
152 fingerprints_list_.erase(fingerprints_list_.begin() + index); | 151 fingerprints_list_.erase(fingerprints_list_.begin() + index); |
153 ResolveJavascriptCallback(base::StringValue(callback_id), | 152 ResolveJavascriptCallback(base::StringValue(callback_id), |
154 base::FundamentalValue(deleteSucessful)); | 153 base::Value(deleteSucessful)); |
155 } | 154 } |
156 | 155 |
157 void FingerprintHandler::HandleChangeEnrollmentLabel( | 156 void FingerprintHandler::HandleChangeEnrollmentLabel( |
158 const base::ListValue* args) { | 157 const base::ListValue* args) { |
159 CHECK_EQ(2U, args->GetSize()); | 158 CHECK_EQ(2U, args->GetSize()); |
160 int index; | 159 int index; |
161 std::string new_label; | 160 std::string new_label; |
162 CHECK(args->GetInteger(0, &index)); | 161 CHECK(args->GetInteger(0, &index)); |
163 CHECK(args->GetString(1, &new_label)); | 162 CHECK(args->GetString(1, &new_label)); |
164 | 163 |
(...skipping 20 matching lines...) Expand all Loading... |
185 if (std::find(fingerprints_list_.begin(), fingerprints_list_.end(), | 184 if (std::find(fingerprints_list_.begin(), fingerprints_list_.end(), |
186 fingerprint_name) == fingerprints_list_.end()) { | 185 fingerprint_name) == fingerprints_list_.end()) { |
187 fingerprints_list_.push_back(fingerprint_name); | 186 fingerprints_list_.push_back(fingerprint_name); |
188 break; | 187 break; |
189 } | 188 } |
190 } | 189 } |
191 } | 190 } |
192 | 191 |
193 } // namespace settings | 192 } // namespace settings |
194 } // namespace chromeos | 193 } // namespace chromeos |
OLD | NEW |