| 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, |
| 201 net::CertificateList()), |
| 200 net::SSLConfigService::GetCRLSet().get(), verify_result_ptr, | 202 net::SSLConfigService::GetCRLSet().get(), verify_result_ptr, |
| 201 bound_callback, &request_state->request, *net_log); | 203 bound_callback, &request_state->request, *net_log); |
| 202 | 204 |
| 203 if (return_value != net::ERR_IO_PENDING) { | 205 if (return_value != net::ERR_IO_PENDING) { |
| 204 bound_callback.Run(return_value); | 206 bound_callback.Run(return_value); |
| 205 return; | 207 return; |
| 206 } | 208 } |
| 207 } | 209 } |
| 208 | 210 |
| 209 void VerifyTrustAPI::IOPart::OnExtensionUnloaded( | 211 void VerifyTrustAPI::IOPart::OnExtensionUnloaded( |
| 210 const std::string& extension_id) { | 212 const std::string& extension_id) { |
| 211 extension_to_verifier_.erase(extension_id); | 213 extension_to_verifier_.erase(extension_id); |
| 212 } | 214 } |
| 213 | 215 |
| 214 void VerifyTrustAPI::IOPart::CallBackWithResult( | 216 void VerifyTrustAPI::IOPart::CallBackWithResult( |
| 215 const VerifyCallback& callback, | 217 const VerifyCallback& callback, |
| 216 std::unique_ptr<net::CertVerifyResult> verify_result, | 218 std::unique_ptr<net::CertVerifyResult> verify_result, |
| 217 RequestState* request_state, | 219 RequestState* request_state, |
| 218 int return_value) { | 220 int return_value) { |
| 219 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 221 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 220 | 222 |
| 221 callback.Run(std::string() /* no error message */, return_value, | 223 callback.Run(std::string() /* no error message */, return_value, |
| 222 verify_result->cert_status); | 224 verify_result->cert_status); |
| 223 } | 225 } |
| 224 | 226 |
| 225 } // namespace extensions | 227 } // namespace extensions |
| OLD | NEW |