| 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..c41b4f76e5ce5fbe144c11214c0b77fdca4f1d5c 100644
|
| --- a/chrome/browser/ui/cocoa/certificate_viewer.mm
|
| +++ b/chrome/browser/ui/cocoa/certificate_viewer.mm
|
| @@ -9,30 +9,16 @@
|
|
|
| #include <vector>
|
|
|
| -#include "base/logging.h"
|
| +#include "base/mac/foundation_util.h"
|
| #include "base/mac/scoped_cftyperef.h"
|
| #include "net/base/x509_certificate.h"
|
| +#include "net/base/x509_util_mac.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(
|
| + net::x509_util::CreateOSCertChainForCert(cert));
|
| + 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 +63,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.
|
| }
|
|
|