| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/ios/block_types.h" | 9 #include "base/ios/block_types.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/mac/bind_objc_block.h" | 11 #include "base/mac/bind_objc_block.h" |
| 12 #import "base/memory/ref_counted.h" | 12 #import "base/memory/ref_counted.h" |
| 13 #include "base/strings/sys_string_conversions.h" | 13 #include "base/strings/sys_string_conversions.h" |
| 14 #include "base/threading/worker_pool.h" | 14 #include "base/threading/worker_pool.h" |
| 15 #include "ios/web/public/browser_state.h" | 15 #include "ios/web/public/browser_state.h" |
| 16 #include "ios/web/public/certificate_policy_cache.h" | 16 #include "ios/web/public/certificate_policy_cache.h" |
| 17 #include "ios/web/public/web_thread.h" | 17 #include "ios/web/public/web_thread.h" |
| 18 #import "ios/web/web_state/wk_web_view_security_util.h" | 18 #import "ios/web/web_state/wk_web_view_security_util.h" |
| 19 #include "net/cert/cert_verify_proc_ios.h" | 19 #include "net/cert/cert_verify_proc_ios.h" |
| 20 | 20 |
| 21 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 22 #error "This file requires ARC support." |
| 23 #endif |
| 24 |
| 21 @interface CRWCertVerificationController () { | 25 @interface CRWCertVerificationController () { |
| 22 // Used to remember user exceptions to invalid certs. | 26 // Used to remember user exceptions to invalid certs. |
| 23 scoped_refptr<web::CertificatePolicyCache> _certPolicyCache; | 27 scoped_refptr<web::CertificatePolicyCache> _certPolicyCache; |
| 24 } | 28 } |
| 25 | 29 |
| 26 // Returns cert status for the given |trust|. | 30 // Returns cert status for the given |trust|. |
| 27 - (net::CertStatus)certStatusFromTrustResult:(SecTrustResultType)trustResult | 31 - (net::CertStatus)certStatusFromTrustResult:(SecTrustResultType)trustResult |
| 28 serverTrust: | 32 serverTrust: |
| 29 (base::ScopedCFTypeRef<SecTrustRef>)trust; | 33 (base::ScopedCFTypeRef<SecTrustRef>)trust; |
| 30 | 34 |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 | 223 |
| 220 web::CertPolicy::Judgment judgment = _certPolicyCache->QueryPolicy( | 224 web::CertPolicy::Judgment judgment = _certPolicyCache->QueryPolicy( |
| 221 leafCert.get(), base::SysNSStringToUTF8(host), certStatus); | 225 leafCert.get(), base::SysNSStringToUTF8(host), certStatus); |
| 222 | 226 |
| 223 return (judgment == web::CertPolicy::ALLOWED) | 227 return (judgment == web::CertPolicy::ALLOWED) |
| 224 ? web::CERT_ACCEPT_POLICY_RECOVERABLE_ERROR_ACCEPTED_BY_USER | 228 ? web::CERT_ACCEPT_POLICY_RECOVERABLE_ERROR_ACCEPTED_BY_USER |
| 225 : web::CERT_ACCEPT_POLICY_RECOVERABLE_ERROR_UNDECIDED_BY_USER; | 229 : web::CERT_ACCEPT_POLICY_RECOVERABLE_ERROR_UNDECIDED_BY_USER; |
| 226 } | 230 } |
| 227 | 231 |
| 228 @end | 232 @end |
| OLD | NEW |