| Index: chrome/browser/ui/views/certificate_viewer_win.cc
|
| diff --git a/chrome/browser/ui/views/certificate_viewer_win.cc b/chrome/browser/ui/views/certificate_viewer_win.cc
|
| index ba54267100e94e820eaaca1da10b65bedfbacd9d..b49a2391e47f9b516bb55d4aed7c30f06d8febb1 100644
|
| --- a/chrome/browser/ui/views/certificate_viewer_win.cc
|
| +++ b/chrome/browser/ui/views/certificate_viewer_win.cc
|
| @@ -8,10 +8,15 @@
|
| #include <cryptuiapi.h>
|
| #pragma comment(lib, "cryptui.lib")
|
|
|
| +#include "base/logging.h"
|
| #include "net/base/x509_certificate.h"
|
|
|
| void ShowCertificateViewer(gfx::NativeWindow parent,
|
| net::X509Certificate* cert) {
|
| + net::X509Certificate::OSCertListHandle cert_list =
|
| + cert->CreateOSCertListHandle();
|
| + CHECK(cert_list);
|
| +
|
| CRYPTUI_VIEWCERTIFICATE_STRUCT view_info = { 0 };
|
| view_info.dwSize = sizeof(view_info);
|
| // We set our parent to the tab window. This makes the cert dialog created
|
| @@ -19,9 +24,9 @@ void ShowCertificateViewer(gfx::NativeWindow parent,
|
| view_info.hwndParent = parent;
|
| view_info.dwFlags = CRYPTUI_DISABLE_EDITPROPERTIES |
|
| CRYPTUI_DISABLE_ADDTOSTORE;
|
| - view_info.pCertContext = cert->os_cert_handle();
|
| + view_info.pCertContext = cert_list;
|
| // Search the cert store that 'cert' is in when building the cert chain.
|
| - HCERTSTORE cert_store = view_info.pCertContext->hCertStore;
|
| + HCERTSTORE cert_store = const_cast<const HCERTSTORE>(cert_list->hCertStore);
|
| view_info.cStores = 1;
|
| view_info.rghStores = &cert_store;
|
| BOOL properties_changed;
|
| @@ -29,4 +34,6 @@ void ShowCertificateViewer(gfx::NativeWindow parent,
|
| // This next call blocks but keeps processing windows messages, making it
|
| // modal to the browser window.
|
| BOOL rv = ::CryptUIDlgViewCertificate(&view_info, &properties_changed);
|
| +
|
| + net::X509Certificate::FreeOSCertListHandle(cert_list);
|
| }
|
|
|