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

Side by Side Diff: chrome/browser/ui/views/certificate_viewer_win.cc

Issue 10554010: Remove BrowserList::GetLastActive usage from WebUI pages. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: review comments Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/views/browser_dialogs.h ('k') | chrome/browser/ui/views/frame/browser_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/certificate_viewer.h" 5 #include "chrome/browser/certificate_viewer.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <cryptuiapi.h> 8 #include <cryptuiapi.h>
9 #pragma comment(lib, "cryptui.lib") 9 #pragma comment(lib, "cryptui.lib")
10 10
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "net/base/x509_certificate.h" 12 #include "net/base/x509_certificate.h"
13 13
14 void ShowCertificateViewer(gfx::NativeWindow parent, 14 void ShowCertificateViewer(content::WebContents* web_contents,
15 gfx::NativeWindow parent,
15 net::X509Certificate* cert) { 16 net::X509Certificate* cert) {
16 // Create a new cert context and store containing just the certificate 17 // Create a new cert context and store containing just the certificate
17 // and its intermediate certificates. 18 // and its intermediate certificates.
18 PCCERT_CONTEXT cert_list = cert->CreateOSCertChainForCert(); 19 PCCERT_CONTEXT cert_list = cert->CreateOSCertChainForCert();
19 CHECK(cert_list); 20 CHECK(cert_list);
20 21
21 CRYPTUI_VIEWCERTIFICATE_STRUCT view_info = { 0 }; 22 CRYPTUI_VIEWCERTIFICATE_STRUCT view_info = { 0 };
22 view_info.dwSize = sizeof(view_info); 23 view_info.dwSize = sizeof(view_info);
23 // We set our parent to the tab window. This makes the cert dialog created 24 // We set our parent to the tab window. This makes the cert dialog created
24 // in CryptUIDlgViewCertificate modal to the browser. 25 // in CryptUIDlgViewCertificate modal to the browser.
25 view_info.hwndParent = parent; 26 view_info.hwndParent = parent;
26 view_info.dwFlags = CRYPTUI_DISABLE_EDITPROPERTIES | 27 view_info.dwFlags = CRYPTUI_DISABLE_EDITPROPERTIES |
27 CRYPTUI_DISABLE_ADDTOSTORE; 28 CRYPTUI_DISABLE_ADDTOSTORE;
28 view_info.pCertContext = cert_list; 29 view_info.pCertContext = cert_list;
29 HCERTSTORE cert_store = cert_list->hCertStore; 30 HCERTSTORE cert_store = cert_list->hCertStore;
30 view_info.cStores = 1; 31 view_info.cStores = 1;
31 view_info.rghStores = &cert_store; 32 view_info.rghStores = &cert_store;
32 BOOL properties_changed; 33 BOOL properties_changed;
33 34
34 // This next call blocks but keeps processing windows messages, making it 35 // This next call blocks but keeps processing windows messages, making it
35 // modal to the browser window. 36 // modal to the browser window.
36 BOOL rv = ::CryptUIDlgViewCertificate(&view_info, &properties_changed); 37 BOOL rv = ::CryptUIDlgViewCertificate(&view_info, &properties_changed);
37 38
38 CertFreeCertificateContext(cert_list); 39 CertFreeCertificateContext(cert_list);
39 } 40 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/browser_dialogs.h ('k') | chrome/browser/ui/views/frame/browser_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698