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

Unified Diff: chrome/browser/chrome_content_browser_client.cc

Issue 2898573002: Refactor client cert private key handling. (Closed)
Patch Set: removed no longer needed forward declaration Created 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chrome_content_browser_client.cc
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index ed80234d23301568dab2b44bde2caa4504f8a69f..99cccebd4f579eefda54a55fbb08b7eacd5193f0 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -2275,7 +2275,7 @@ void ChromeContentBrowserClient::AllowCertificateError(
void ChromeContentBrowserClient::SelectClientCertificate(
content::WebContents* web_contents,
net::SSLCertRequestInfo* cert_request_info,
- net::CertificateList client_certs,
+ net::ClientCertIdentityList client_certs,
std::unique_ptr<content::ClientCertificateDelegate> delegate) {
prerender::PrerenderContents* prerender_contents =
prerender::PrerenderContents::FromWebContents(web_contents);
@@ -2304,9 +2304,17 @@ void ChromeContentBrowserClient::SelectClientCertificate(
static_cast<base::DictionaryValue*>(filter.get());
for (size_t i = 0; i < client_certs.size(); ++i) {
- if (CertMatchesFilter(*client_certs[i].get(), *filter_dict)) {
+ if (CertMatchesFilter(*client_certs[i]->certificate(), *filter_dict)) {
// Use the first certificate that is matched by the filter.
- delegate->ContinueWithCertificate(client_certs[i].get());
+ // The callback will own |client_certs[i]| and |delegate|, keeping
+ // them alive until after ContinueWithCertificate is called.
+ scoped_refptr<net::X509Certificate> cert =
+ client_certs[i]->certificate();
+ net::ClientCertIdentity::SelfOwningAcquirePrivateKey(
+ std::move(client_certs[i]),
+ base::Bind(
+ &content::ClientCertificateDelegate::ContinueWithCertificate,
+ base::Passed(&delegate), std::move(cert)));
return;
}
}
« no previous file with comments | « chrome/browser/chrome_content_browser_client.h ('k') | chrome/browser/chromeos/net/client_cert_store_chromeos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698