| 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/verify_trust_api.h" | 5 #include "chrome/browser/extensions/api/platform_keys/verify_trust_api.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 | 189 |
| 190 std::string ocsp_response; | 190 std::string ocsp_response; |
| 191 net::CertVerifyResult* const verify_result_ptr = verify_result.get(); | 191 net::CertVerifyResult* const verify_result_ptr = verify_result.get(); |
| 192 | 192 |
| 193 RequestState* request_state = new RequestState(); | 193 RequestState* request_state = new RequestState(); |
| 194 base::Callback<void(int)> bound_callback( | 194 base::Callback<void(int)> bound_callback( |
| 195 base::Bind(&IOPart::CallBackWithResult, base::Unretained(this), callback, | 195 base::Bind(&IOPart::CallBackWithResult, base::Unretained(this), callback, |
| 196 base::Passed(&verify_result), base::Owned(request_state))); | 196 base::Passed(&verify_result), base::Owned(request_state))); |
| 197 | 197 |
| 198 const int return_value = verifier->Verify( | 198 const int return_value = verifier->Verify( |
| 199 cert_chain.get(), details.hostname, ocsp_response, flags, | 199 net::CertVerifier::RequestParams(std::move(cert_chain), details.hostname, |
| 200 flags, ocsp_response, CertificateList()), |
| 200 net::SSLConfigService::GetCRLSet().get(), verify_result_ptr, | 201 net::SSLConfigService::GetCRLSet().get(), verify_result_ptr, |
| 201 bound_callback, &request_state->request, *net_log); | 202 bound_callback, &request_state->request, *net_log); |
| 202 | 203 |
| 203 if (return_value != net::ERR_IO_PENDING) { | 204 if (return_value != net::ERR_IO_PENDING) { |
| 204 bound_callback.Run(return_value); | 205 bound_callback.Run(return_value); |
| 205 return; | 206 return; |
| 206 } | 207 } |
| 207 } | 208 } |
| 208 | 209 |
| 209 void VerifyTrustAPI::IOPart::OnExtensionUnloaded( | 210 void VerifyTrustAPI::IOPart::OnExtensionUnloaded( |
| 210 const std::string& extension_id) { | 211 const std::string& extension_id) { |
| 211 extension_to_verifier_.erase(extension_id); | 212 extension_to_verifier_.erase(extension_id); |
| 212 } | 213 } |
| 213 | 214 |
| 214 void VerifyTrustAPI::IOPart::CallBackWithResult( | 215 void VerifyTrustAPI::IOPart::CallBackWithResult( |
| 215 const VerifyCallback& callback, | 216 const VerifyCallback& callback, |
| 216 std::unique_ptr<net::CertVerifyResult> verify_result, | 217 std::unique_ptr<net::CertVerifyResult> verify_result, |
| 217 RequestState* request_state, | 218 RequestState* request_state, |
| 218 int return_value) { | 219 int return_value) { |
| 219 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 220 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 220 | 221 |
| 221 callback.Run(std::string() /* no error message */, return_value, | 222 callback.Run(std::string() /* no error message */, return_value, |
| 222 verify_result->cert_status); | 223 verify_result->cert_status); |
| 223 } | 224 } |
| 224 | 225 |
| 225 } // namespace extensions | 226 } // namespace extensions |
| OLD | NEW |