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

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

Issue 7096016: Remove JS dialog dependency from content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: now a tc delegate Created 9 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
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/ssl_client_certificate_selector.h" 5 #include "chrome/browser/ssl_client_certificate_selector.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
(...skipping 28 matching lines...) Expand all
39 CERT_STORE_ADD_ALWAYS, NULL); 39 CERT_STORE_ADD_ALWAYS, NULL);
40 DCHECK(ok); 40 DCHECK(ok);
41 } 41 }
42 42
43 std::wstring title = 43 std::wstring title =
44 UTF16ToWide(l10n_util::GetStringUTF16(IDS_CLIENT_CERT_DIALOG_TITLE)); 44 UTF16ToWide(l10n_util::GetStringUTF16(IDS_CLIENT_CERT_DIALOG_TITLE));
45 std::wstring text = UTF16ToWide(l10n_util::GetStringFUTF16( 45 std::wstring text = UTF16ToWide(l10n_util::GetStringFUTF16(
46 IDS_CLIENT_CERT_DIALOG_TEXT, 46 IDS_CLIENT_CERT_DIALOG_TEXT,
47 ASCIIToUTF16(cert_request_info->host_and_port))); 47 ASCIIToUTF16(cert_request_info->host_and_port)));
48 PCCERT_CONTEXT cert_context = CryptUIDlgSelectCertificateFromStore( 48 PCCERT_CONTEXT cert_context = CryptUIDlgSelectCertificateFromStore(
49 client_certs, parent->GetMessageBoxRootWindow(), 49 client_certs, parent->GetDialogRootWindow(),
50 title.c_str(), text.c_str(), 0, 0, NULL); 50 title.c_str(), text.c_str(), 0, 0, NULL);
51 51
52 net::X509Certificate* cert = NULL; 52 net::X509Certificate* cert = NULL;
53 if (cert_context) { 53 if (cert_context) {
54 for (size_t i = 0; i < cert_request_info->client_certs.size(); ++i) { 54 for (size_t i = 0; i < cert_request_info->client_certs.size(); ++i) {
55 net::X509Certificate* client_cert = cert_request_info->client_certs[i]; 55 net::X509Certificate* client_cert = cert_request_info->client_certs[i];
56 if (net::X509Certificate::IsSameOSCert(cert_context, 56 if (net::X509Certificate::IsSameOSCert(cert_context,
57 client_cert->os_cert_handle())) { 57 client_cert->os_cert_handle())) {
58 cert = client_cert; 58 cert = client_cert;
59 break; 59 break;
60 } 60 }
61 } 61 }
62 DCHECK(cert != NULL); 62 DCHECK(cert != NULL);
63 net::X509Certificate::FreeOSCertHandle(cert_context); 63 net::X509Certificate::FreeOSCertHandle(cert_context);
64 } 64 }
65 65
66 ok = CertCloseStore(client_certs, CERT_CLOSE_STORE_CHECK_FLAG); 66 ok = CertCloseStore(client_certs, CERT_CLOSE_STORE_CHECK_FLAG);
67 DCHECK(ok); 67 DCHECK(ok);
68 68
69 delegate->CertificateSelected(cert); 69 delegate->CertificateSelected(cert);
70 } 70 }
71 71
72 } // namespace browser 72 } // namespace browser
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698