| 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 #import "base/ios/block_types.h" | 9 #import "base/ios/block_types.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 })); | 187 })); |
| 188 } | 188 } |
| 189 | 189 |
| 190 - (void)verifyTrust:(base::ScopedCFTypeRef<SecTrustRef>)trust | 190 - (void)verifyTrust:(base::ScopedCFTypeRef<SecTrustRef>)trust |
| 191 completionHandler:(void (^)(SecTrustResultType))completionHandler { | 191 completionHandler:(void (^)(SecTrustResultType))completionHandler { |
| 192 DCHECK_CURRENTLY_ON(web::WebThread::UI); | 192 DCHECK_CURRENTLY_ON(web::WebThread::UI); |
| 193 DCHECK(completionHandler); | 193 DCHECK(completionHandler); |
| 194 // SecTrustEvaluate performs trust evaluation synchronously, possibly making | 194 // SecTrustEvaluate performs trust evaluation synchronously, possibly making |
| 195 // network requests. The UI thread should not be blocked by that operation. | 195 // network requests. The UI thread should not be blocked by that operation. |
| 196 base::PostTaskWithTraits( | 196 base::PostTaskWithTraits( |
| 197 FROM_HERE, | 197 FROM_HERE, {base::TaskShutdownBehavior::BLOCK_SHUTDOWN}, |
| 198 base::TaskTraits().WithShutdownBehavior( | |
| 199 base::TaskShutdownBehavior::BLOCK_SHUTDOWN), | |
| 200 base::BindBlockArc(^{ | 198 base::BindBlockArc(^{ |
| 201 SecTrustResultType trustResult = kSecTrustResultInvalid; | 199 SecTrustResultType trustResult = kSecTrustResultInvalid; |
| 202 if (SecTrustEvaluate(trust.get(), &trustResult) != errSecSuccess) { | 200 if (SecTrustEvaluate(trust.get(), &trustResult) != errSecSuccess) { |
| 203 trustResult = kSecTrustResultInvalid; | 201 trustResult = kSecTrustResultInvalid; |
| 204 } | 202 } |
| 205 // Use GCD API, which is guaranteed to be called during shutdown. | 203 // Use GCD API, which is guaranteed to be called during shutdown. |
| 206 dispatch_async(dispatch_get_main_queue(), ^{ | 204 dispatch_async(dispatch_get_main_queue(), ^{ |
| 207 completionHandler(trustResult); | 205 completionHandler(trustResult); |
| 208 }); | 206 }); |
| 209 })); | 207 })); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 234 | 232 |
| 235 web::CertPolicy::Judgment judgment = _certPolicyCache->QueryPolicy( | 233 web::CertPolicy::Judgment judgment = _certPolicyCache->QueryPolicy( |
| 236 leafCert.get(), base::SysNSStringToUTF8(host), certStatus); | 234 leafCert.get(), base::SysNSStringToUTF8(host), certStatus); |
| 237 | 235 |
| 238 return (judgment == web::CertPolicy::ALLOWED) | 236 return (judgment == web::CertPolicy::ALLOWED) |
| 239 ? web::CERT_ACCEPT_POLICY_RECOVERABLE_ERROR_ACCEPTED_BY_USER | 237 ? web::CERT_ACCEPT_POLICY_RECOVERABLE_ERROR_ACCEPTED_BY_USER |
| 240 : web::CERT_ACCEPT_POLICY_RECOVERABLE_ERROR_UNDECIDED_BY_USER; | 238 : web::CERT_ACCEPT_POLICY_RECOVERABLE_ERROR_UNDECIDED_BY_USER; |
| 241 } | 239 } |
| 242 | 240 |
| 243 @end | 241 @end |
| OLD | NEW |