| 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 #import "ios/web/net/crw_cert_verification_controller.h" | 5 #import "ios/web/net/crw_cert_verification_controller.h" |
| 6 | 6 |
| 7 #include "base/ios/block_types.h" | 7 #include "base/ios/block_types.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/mac/bind_objc_block.h" | 9 #include "base/mac/bind_objc_block.h" |
| 10 #include "base/mac/scoped_block.h" | 10 #include "base/mac/scoped_block.h" |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 DCHECK(completionHandler); | 419 DCHECK(completionHandler); |
| 420 __block scoped_refptr<net::X509Certificate> blockCert = cert; | 420 __block scoped_refptr<net::X509Certificate> blockCert = cert; |
| 421 web::WebThread::PostTask(web::WebThread::IO, FROM_HERE, base::BindBlock(^{ | 421 web::WebThread::PostTask(web::WebThread::IO, FROM_HERE, base::BindBlock(^{ |
| 422 // WeakNSObject does not work across different threads, hence this block | 422 // WeakNSObject does not work across different threads, hence this block |
| 423 // retains self. | 423 // retains self. |
| 424 if (!_certVerifier) { | 424 if (!_certVerifier) { |
| 425 completionHandler(net::CertVerifyResult()); | 425 completionHandler(net::CertVerifyResult()); |
| 426 return; | 426 return; |
| 427 } | 427 } |
| 428 | 428 |
| 429 web::CertVerifierBlockAdapter::Params params( | 429 web::CertVerifierBlockAdapter::Params params(std::move(blockCert), |
| 430 blockCert.Pass(), base::SysNSStringToUTF8(host)); | 430 base::SysNSStringToUTF8(host)); |
| 431 params.flags = self.certVerifyFlags; | 431 params.flags = self.certVerifyFlags; |
| 432 // OCSP response is not provided by iOS API. | 432 // OCSP response is not provided by iOS API. |
| 433 // CRLSets are not used, as the OS is used to make load/no-load | 433 // CRLSets are not used, as the OS is used to make load/no-load |
| 434 // decisions, not the CertVerifier. | 434 // decisions, not the CertVerifier. |
| 435 _certVerifier->Verify(params, ^(net::CertVerifyResult result, int) { | 435 _certVerifier->Verify(params, ^(net::CertVerifyResult result, int) { |
| 436 completionHandler(result); | 436 completionHandler(result); |
| 437 }); | 437 }); |
| 438 })); | 438 })); |
| 439 } | 439 } |
| 440 | 440 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 web::CertPolicy::Judgment judgment = _certPolicyCache->QueryPolicy( | 476 web::CertPolicy::Judgment judgment = _certPolicyCache->QueryPolicy( |
| 477 leafCert.get(), base::SysNSStringToUTF8(host), | 477 leafCert.get(), base::SysNSStringToUTF8(host), |
| 478 certVerifierResult.cert_status); | 478 certVerifierResult.cert_status); |
| 479 | 479 |
| 480 return (judgment == web::CertPolicy::ALLOWED) | 480 return (judgment == web::CertPolicy::ALLOWED) |
| 481 ? web::CERT_ACCEPT_POLICY_RECOVERABLE_ERROR_ACCEPTED_BY_USER | 481 ? web::CERT_ACCEPT_POLICY_RECOVERABLE_ERROR_ACCEPTED_BY_USER |
| 482 : web::CERT_ACCEPT_POLICY_RECOVERABLE_ERROR_UNDECIDED_BY_USER; | 482 : web::CERT_ACCEPT_POLICY_RECOVERABLE_ERROR_UNDECIDED_BY_USER; |
| 483 } | 483 } |
| 484 | 484 |
| 485 @end | 485 @end |
| OLD | NEW |