Chromium Code Reviews| Index: chrome/browser/ui/cocoa/certificate_viewer.mm |
| diff --git a/chrome/browser/ui/cocoa/certificate_viewer.mm b/chrome/browser/ui/cocoa/certificate_viewer.mm |
| index 3b6a656e152e1246ac9a738180092afe72b7611b..7334ea8c24386a0945447395019087cb676aacda 100644 |
| --- a/chrome/browser/ui/cocoa/certificate_viewer.mm |
| +++ b/chrome/browser/ui/cocoa/certificate_viewer.mm |
| @@ -9,30 +9,15 @@ |
| #include <vector> |
| -#include "base/logging.h" |
| +#include "base/mac/mac_util.h" |
|
wtc
2011/10/04 00:26:34
I believe we can include "base/mac/foundation_util
|
| #include "base/mac/scoped_cftyperef.h" |
| #include "net/base/x509_certificate.h" |
| void ShowCertificateViewer(gfx::NativeWindow parent, |
| net::X509Certificate* cert) { |
| - SecCertificateRef cert_mac = cert->os_cert_handle(); |
| - if (!cert_mac) |
| - return; |
| - |
| - base::mac::ScopedCFTypeRef<CFMutableArrayRef> certificates( |
| - CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks)); |
| - if (!certificates.get()) { |
| - NOTREACHED(); |
| - return; |
| - } |
| - CFArrayAppendValue(certificates, cert_mac); |
| - |
| - // Server certificate must be first in the array; subsequent certificates |
| - // in the chain can be in any order. |
| - const std::vector<SecCertificateRef>& ca_certs = |
| - cert->GetIntermediateCertificates(); |
| - for (size_t i = 0; i < ca_certs.size(); ++i) |
| - CFArrayAppendValue(certificates, ca_certs[i]); |
| + base::mac::ScopedCFTypeRef<CFArrayRef> cert_list( |
| + cert->CreateOSCertListHandle()); |
| + NSArray* certificates = base::mac::CFToNSCast(cert_list.get()); |
| // Explicitly disable revocation checking, regardless of user preferences |
| // or system settings. The behaviour of SFCertificatePanel is to call |
| @@ -77,7 +62,7 @@ void ShowCertificateViewer(gfx::NativeWindow parent, |
| modalDelegate:nil |
| didEndSelector:NULL |
| contextInfo:NULL |
| - certificates:reinterpret_cast<NSArray*>(certificates.get()) |
| + certificates:certificates |
| showGroup:YES]; |
| // The SFCertificatePanel releases itself when the sheet is dismissed. |
| } |