diff options
author | svaldez <svaldez@chromium.org> | 2016-01-20 14:13:59 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-20 22:15:13 +0000 |
commit | c4b6f127649838216706911d115da182b399b92f (patch) | |
tree | ac18389c307840914c1c9949da7206845e952c25 /ios | |
parent | fb5f7e8284388af23867bd79a04275c2b1d122d8 (diff) | |
download | chromium_src-c4b6f127649838216706911d115da182b399b92f.zip chromium_src-c4b6f127649838216706911d115da182b399b92f.tar.gz chromium_src-c4b6f127649838216706911d115da182b399b92f.tar.bz2 |
Make X509Certificate methods return a scoped_refptr
Making X509Certificate methods return scoped_refptr in order to force
the caller to use scoped_refptr.
BUG=577397
Review URL: https://codereview.chromium.org/1586133002
Cr-Commit-Position: refs/heads/master@{#370508}
Diffstat (limited to 'ios')
-rw-r--r-- | ios/web/navigation/crw_session_certificate_policy_manager.h | 3 | ||||
-rw-r--r-- | ios/web/navigation/crw_session_certificate_policy_manager.mm | 10 |
2 files changed, 8 insertions, 5 deletions
diff --git a/ios/web/navigation/crw_session_certificate_policy_manager.h b/ios/web/navigation/crw_session_certificate_policy_manager.h index a97e913..72553c1 100644 --- a/ios/web/navigation/crw_session_certificate_policy_manager.h +++ b/ios/web/navigation/crw_session_certificate_policy_manager.h @@ -26,7 +26,8 @@ class CertificatePolicyCache; // The CRWSessionCertificatePolicyManager lives on the main thread. @interface CRWSessionCertificatePolicyManager : NSObject <NSCoding, NSCopying> -- (void)registerAllowedCertificate:(net::X509Certificate*)certificate +- (void)registerAllowedCertificate: + (const scoped_refptr<net::X509Certificate>)certificate forHost:(const std::string&)host status:(net::CertStatus)status; diff --git a/ios/web/navigation/crw_session_certificate_policy_manager.mm b/ios/web/navigation/crw_session_certificate_policy_manager.mm index 735ac1c..5be4bae 100644 --- a/ios/web/navigation/crw_session_certificate_policy_manager.mm +++ b/ios/web/navigation/crw_session_certificate_policy_manager.mm @@ -76,7 +76,7 @@ NSData* CertificateToNSData(net::X509Certificate* certificate) { return [NSData dataWithBytes:s.c_str() length:s.length()]; } -net::X509Certificate* NSDataToCertificate(NSData* data) { +scoped_refptr<net::X509Certificate> NSDataToCertificate(NSData* data) { return net::X509Certificate::CreateFromBytes((const char *)[data bytes], [data length]); } @@ -99,7 +99,8 @@ void AddToCertificatePolicyCache( AllowedCertificates allowed_; } -- (void)registerAllowedCertificate:(net::X509Certificate*)certificate +- (void)registerAllowedCertificate: + (const scoped_refptr<net::X509Certificate>)certificate forHost:(const std::string&)host status:(net::CertStatus)status { DCHECK([NSThread isMainThread]); @@ -140,11 +141,12 @@ void AddToCertificatePolicyCache( NOTREACHED(); continue; } - net::X509Certificate* c = NSDataToCertificate([fields objectAtIndex:0]); + scoped_refptr<net::X509Certificate> cert = + NSDataToCertificate([fields objectAtIndex:0]); std::string host = base::SysNSStringToUTF8([fields objectAtIndex:1]); net::CertStatus status = (net::CertStatus)[[fields objectAtIndex:2] unsignedIntegerValue]; - [self registerAllowedCertificate:c forHost:host status:status]; + [self registerAllowedCertificate:cert forHost:host status:status]; } } return self; |