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

Unified Diff: chrome/browser/ui/cocoa/certificate_viewer.mm

Issue 7324039: Ensure X509Certificate::OSCertHandles are safe to be used on both UI and IO threads on Win (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/certificate_viewer_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..8fbe2afe9f80101cccdab791b368c500c454caa9 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/foundation_util.h"
#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_chain(
+ cert->CreateOSCertChainForCert());
+ NSArray* certificates = base::mac::CFToNSCast(cert_chain.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.
}
« no previous file with comments | « no previous file | chrome/browser/ui/views/certificate_viewer_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698