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

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

Issue 2838243002: Remove client_certs from SSLCertRequestInfo. (Closed)
Patch Set: revert stray whitespace change Created 3 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/views/ssl_client_certificate_selector.h" 5 #include "chrome/browser/ui/views/ssl_client_certificate_selector.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "chrome/grit/generated_resources.h" 13 #include "chrome/grit/generated_resources.h"
14 #include "content/public/browser/browser_thread.h" 14 #include "content/public/browser/browser_thread.h"
15 #include "content/public/browser/client_certificate_delegate.h" 15 #include "content/public/browser/client_certificate_delegate.h"
16 #include "content/public/browser/web_contents.h" 16 #include "content/public/browser/web_contents.h"
17 #include "net/cert/x509_certificate.h" 17 #include "net/cert/x509_certificate.h"
18 #include "net/ssl/ssl_cert_request_info.h" 18 #include "net/ssl/ssl_cert_request_info.h"
19 #include "ui/base/l10n/l10n_util.h" 19 #include "ui/base/l10n/l10n_util.h"
20 #include "ui/views/controls/label.h" 20 #include "ui/views/controls/label.h"
21 #include "ui/views/widget/widget.h" 21 #include "ui/views/widget/widget.h"
22 22
23 #if defined(USE_NSS_CERTS) && !defined(OS_CHROMEOS) 23 #if defined(USE_NSS_CERTS) && !defined(OS_CHROMEOS)
24 #include "chrome/browser/ui/crypto_module_password_dialog_nss.h" 24 #include "chrome/browser/ui/crypto_module_password_dialog_nss.h"
25 #endif 25 #endif
26 26
27 SSLClientCertificateSelector::SSLClientCertificateSelector( 27 SSLClientCertificateSelector::SSLClientCertificateSelector(
28 content::WebContents* web_contents, 28 content::WebContents* web_contents,
29 const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info, 29 const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info,
30 net::CertificateList client_certs,
30 std::unique_ptr<content::ClientCertificateDelegate> delegate) 31 std::unique_ptr<content::ClientCertificateDelegate> delegate)
31 : CertificateSelector(cert_request_info->client_certs, web_contents), 32 : CertificateSelector(std::move(client_certs), web_contents),
32 SSLClientAuthObserver(web_contents->GetBrowserContext(), 33 SSLClientAuthObserver(web_contents->GetBrowserContext(),
33 cert_request_info, 34 cert_request_info,
34 std::move(delegate)), 35 std::move(delegate)),
35 WebContentsObserver(web_contents) {} 36 WebContentsObserver(web_contents) {}
36 37
37 SSLClientCertificateSelector::~SSLClientCertificateSelector() {} 38 SSLClientCertificateSelector::~SSLClientCertificateSelector() {}
38 39
39 void SSLClientCertificateSelector::Init() { 40 void SSLClientCertificateSelector::Init() {
40 StartObserving(); 41 StartObserving();
41 std::unique_ptr<views::Label> text_label( 42 std::unique_ptr<views::Label> text_label(
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 void SSLClientCertificateSelector::Unlocked(net::X509Certificate* cert) { 93 void SSLClientCertificateSelector::Unlocked(net::X509Certificate* cert) {
93 CertificateSelected(cert); 94 CertificateSelected(cert);
94 GetWidget()->Close(); 95 GetWidget()->Close();
95 } 96 }
96 97
97 namespace chrome { 98 namespace chrome {
98 99
99 void ShowSSLClientCertificateSelector( 100 void ShowSSLClientCertificateSelector(
100 content::WebContents* contents, 101 content::WebContents* contents,
101 net::SSLCertRequestInfo* cert_request_info, 102 net::SSLCertRequestInfo* cert_request_info,
103 net::CertificateList client_certs,
102 std::unique_ptr<content::ClientCertificateDelegate> delegate) { 104 std::unique_ptr<content::ClientCertificateDelegate> delegate) {
103 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 105 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
104 106
105 // Not all WebContentses can show modal dialogs. 107 // Not all WebContentses can show modal dialogs.
106 // 108 //
107 // TODO(davidben): Move this hook to the WebContentsDelegate and only try to 109 // TODO(davidben): Move this hook to the WebContentsDelegate and only try to
108 // show a dialog in Browser's implementation. https://crbug.com/456255 110 // show a dialog in Browser's implementation. https://crbug.com/456255
109 if (!SSLClientCertificateSelector::CanShow(contents)) 111 if (!SSLClientCertificateSelector::CanShow(contents))
110 return; 112 return;
111 113
112 SSLClientCertificateSelector* selector = new SSLClientCertificateSelector( 114 SSLClientCertificateSelector* selector = new SSLClientCertificateSelector(
113 contents, cert_request_info, std::move(delegate)); 115 contents, cert_request_info, std::move(client_certs),
116 std::move(delegate));
114 selector->Init(); 117 selector->Init();
115 selector->Show(); 118 selector->Show();
116 } 119 }
117 120
118 } // namespace chrome 121 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698