OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/extensions/api/platform_keys/platform_keys_api.h" | 5 #include "chrome/browser/extensions/api/platform_keys/platform_keys_api.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 base::Bind(&PlatformKeysInternalSelectClientCertificatesFunction:: | 170 base::Bind(&PlatformKeysInternalSelectClientCertificatesFunction:: |
171 OnSelectedCertificates, | 171 OnSelectedCertificates, |
172 this), | 172 this), |
173 GetAssociatedWebContents()); | 173 GetAssociatedWebContents()); |
174 return RespondLater(); | 174 return RespondLater(); |
175 } | 175 } |
176 | 176 |
177 void PlatformKeysInternalSelectClientCertificatesFunction:: | 177 void PlatformKeysInternalSelectClientCertificatesFunction:: |
178 OnSelectedCertificates(scoped_ptr<net::CertificateList> matches, | 178 OnSelectedCertificates(scoped_ptr<net::CertificateList> matches, |
179 const std::string& error_message) { | 179 const std::string& error_message) { |
180 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 180 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
181 if (!error_message.empty()) { | 181 if (!error_message.empty()) { |
182 Respond(Error(error_message)); | 182 Respond(Error(error_message)); |
183 return; | 183 return; |
184 } | 184 } |
185 DCHECK(matches); | 185 DCHECK(matches); |
186 std::vector<linked_ptr<api_pk::Match>> result_matches; | 186 std::vector<linked_ptr<api_pk::Match>> result_matches; |
187 for (const scoped_refptr<net::X509Certificate>& match : *matches) { | 187 for (const scoped_refptr<net::X509Certificate>& match : *matches) { |
188 PublicKeyInfo key_info; | 188 PublicKeyInfo key_info; |
189 key_info.public_key_spki_der = | 189 key_info.public_key_spki_der = |
190 chromeos::platform_keys::GetSubjectPublicKeyInfo(match); | 190 chromeos::platform_keys::GetSubjectPublicKeyInfo(match); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 hash_algorithm, extension_id(), | 259 hash_algorithm, extension_id(), |
260 base::Bind(&PlatformKeysInternalSignFunction::OnSigned, this)); | 260 base::Bind(&PlatformKeysInternalSignFunction::OnSigned, this)); |
261 } | 261 } |
262 | 262 |
263 return RespondLater(); | 263 return RespondLater(); |
264 } | 264 } |
265 | 265 |
266 void PlatformKeysInternalSignFunction::OnSigned( | 266 void PlatformKeysInternalSignFunction::OnSigned( |
267 const std::string& signature, | 267 const std::string& signature, |
268 const std::string& error_message) { | 268 const std::string& error_message) { |
269 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 269 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
270 if (error_message.empty()) | 270 if (error_message.empty()) |
271 Respond(ArgumentList(api_pki::Sign::Results::Create( | 271 Respond(ArgumentList(api_pki::Sign::Results::Create( |
272 std::vector<char>(signature.begin(), signature.end())))); | 272 std::vector<char>(signature.begin(), signature.end())))); |
273 else | 273 else |
274 Respond(Error(error_message)); | 274 Respond(Error(error_message)); |
275 } | 275 } |
276 | 276 |
277 } // namespace extensions | 277 } // namespace extensions |
OLD | NEW |