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

Unified Diff: chrome/browser/ssl/ssl_client_auth_observer.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
« no previous file with comments | « chrome/browser/ssl/ssl_client_auth_observer.h ('k') | chrome/browser/ssl/ssl_client_auth_requestor_mock.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ssl/ssl_client_auth_observer.cc
diff --git a/chrome/browser/ssl/ssl_client_auth_observer.cc b/chrome/browser/ssl/ssl_client_auth_observer.cc
index 794fff373e2663989bc5c82580e42afc1abc039d..64748b78c57b2a352727db0319f715c7bef8436a 100644
--- a/chrome/browser/ssl/ssl_client_auth_observer.cc
+++ b/chrome/browser/ssl/ssl_client_auth_observer.cc
@@ -4,7 +4,7 @@
#include "chrome/browser/ssl/ssl_client_auth_observer.h"
-#include <utility>
+#include <tuple>
#include "base/bind.h"
#include "base/logging.h"
@@ -14,10 +14,12 @@
#include "content/public/browser/notification_service.h"
#include "net/cert/x509_certificate.h"
#include "net/ssl/ssl_cert_request_info.h"
+#include "net/ssl/ssl_private_key.h"
using content::BrowserThread;
-typedef std::pair<net::SSLCertRequestInfo*, net::X509Certificate*> CertDetails;
+using CertDetails = std::
+ tuple<net::SSLCertRequestInfo*, net::X509Certificate*, net::SSLPrivateKey*>;
SSLClientAuthObserver::SSLClientAuthObserver(
const content::BrowserContext* browser_context,
@@ -31,7 +33,8 @@ SSLClientAuthObserver::~SSLClientAuthObserver() {
}
void SSLClientAuthObserver::CertificateSelected(
- net::X509Certificate* certificate) {
+ net::X509Certificate* certificate,
+ net::SSLPrivateKey* private_key) {
if (!delegate_)
return;
@@ -39,16 +42,14 @@ void SSLClientAuthObserver::CertificateSelected(
// avoid getting a self-notification.
StopObserving();
- CertDetails details;
- details.first = cert_request_info_.get();
- details.second = certificate;
+ CertDetails details(cert_request_info_.get(), certificate, private_key);
content::NotificationService* service =
content::NotificationService::current();
service->Notify(chrome::NOTIFICATION_SSL_CLIENT_AUTH_CERT_SELECTED,
content::Source<content::BrowserContext>(browser_context_),
content::Details<CertDetails>(&details));
- delegate_->ContinueWithCertificate(certificate);
+ delegate_->ContinueWithCertificate(certificate, private_key);
delegate_.reset();
}
@@ -70,14 +71,15 @@ void SSLClientAuthObserver::Observe(
DCHECK_EQ(chrome::NOTIFICATION_SSL_CLIENT_AUTH_CERT_SELECTED, type);
CertDetails* cert_details = content::Details<CertDetails>(details).ptr();
- if (!cert_details->first->host_and_port.Equals(
- cert_request_info_->host_and_port))
+ if (!std::get<0>(*cert_details)
+ ->host_and_port.Equals(cert_request_info_->host_and_port))
return;
DVLOG(1) << this << " got matching notification and selecting cert "
- << cert_details->second;
+ << std::get<1>(*cert_details);
StopObserving();
- delegate_->ContinueWithCertificate(cert_details->second);
+ delegate_->ContinueWithCertificate(std::get<1>(*cert_details),
+ std::get<2>(*cert_details));
delegate_.reset();
OnCertSelectedByNotification();
}
« no previous file with comments | « chrome/browser/ssl/ssl_client_auth_observer.h ('k') | chrome/browser/ssl/ssl_client_auth_requestor_mock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698