Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(469)

Unified Diff: ios/web/web_state/wk_web_view_security_util.mm

Issue 2916473002: [ObjC ARC] Converts ios/web:web to ARC. (Closed)
Patch Set: Adoption of NS_VALID_UNTIL_END_OF_SCOPE Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ios/web/web_state/wk_web_view_security_util.mm
diff --git a/ios/web/web_state/wk_web_view_security_util.mm b/ios/web/web_state/wk_web_view_security_util.mm
index 5b7e446655eda9646d004b66b429f06330a91e8b..fcde80cccc55d7b22adeaaeef5488fea2559bdfd 100644
--- a/ios/web/web_state/wk_web_view_security_util.mm
+++ b/ios/web/web_state/wk_web_view_security_util.mm
@@ -10,6 +10,10 @@
#include "net/cert/x509_util_ios.h"
#include "net/ssl/ssl_info.h"
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
namespace web {
// These keys were determined by inspecting userInfo dict of an SSL error.
@@ -50,10 +54,12 @@ scoped_refptr<net::X509Certificate> CreateCertFromChain(NSArray* certs) {
return nullptr;
std::vector<SecCertificateRef> intermediates;
for (NSUInteger i = 1; i < certs.count; i++) {
- intermediates.push_back(reinterpret_cast<SecCertificateRef>(certs[i]));
+ SecCertificateRef cert = (__bridge SecCertificateRef)certs[i];
+ intermediates.push_back(cert);
}
+ SecCertificateRef initialCert = (__bridge SecCertificateRef)certs[0];
Eugene But (OOO till 7-30) 2017/06/02 23:18:38 s/initialCert/root_cert
PL 2017/06/05 23:26:18 Done!
return net::x509_util::CreateX509CertificateFromSecCertificate(
- reinterpret_cast<SecCertificateRef>(certs[0]), intermediates);
+ reinterpret_cast<SecCertificateRef>(initialCert), intermediates);
}
scoped_refptr<net::X509Certificate> CreateCertFromTrust(SecTrustRef trust) {
@@ -83,7 +89,8 @@ base::ScopedCFTypeRef<SecTrustRef> CreateServerTrustFromChain(NSArray* certs,
base::ScopedCFTypeRef<SecPolicyRef> policy(
SecPolicyCreateSSL(TRUE, static_cast<CFStringRef>(host)));
SecTrustRef ref_result = nullptr;
- if (SecTrustCreateWithCertificates(certs, policy, &ref_result) ==
+ CFArrayRef certificatesArray = (__bridge CFArrayRef)certs;
Eugene But (OOO till 7-30) 2017/06/02 23:18:38 Do you want to drop this local variable? It's hard
PL 2017/06/05 23:26:18 Done! Thanks!
+ if (SecTrustCreateWithCertificates(certificatesArray, policy, &ref_result) ==
errSecSuccess) {
scoped_result.reset(ref_result);
}

Powered by Google App Engine
This is Rietveld 408576698