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

Unified Diff: chrome/browser/ssl/ssl_client_auth_requestor_mock.cc

Issue 859213006: Cancel client auth requests when not promptable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@client-auth-cancel-1
Patch Set: worker_common.js was missing a license header (also a rebase) Created 5 years, 9 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/ssl/ssl_client_auth_requestor_mock.cc
diff --git a/chrome/browser/ssl/ssl_client_auth_requestor_mock.cc b/chrome/browser/ssl/ssl_client_auth_requestor_mock.cc
index 6f63c323818c94d2661f064abd2e91675e1f53c8..ef114b4821dcdd4d9def9fadd54e2f134fb792c9 100644
--- a/chrome/browser/ssl/ssl_client_auth_requestor_mock.cc
+++ b/chrome/browser/ssl/ssl_client_auth_requestor_mock.cc
@@ -4,9 +4,38 @@
#include "chrome/browser/ssl/ssl_client_auth_requestor_mock.h"
+#include "base/macros.h"
+#include "content/public/browser/client_certificate_delegate.h"
#include "net/ssl/ssl_cert_request_info.h"
#include "net/url_request/url_request.h"
+namespace {
+
+class FakeClientCertificateDelegate
+ : public content::ClientCertificateDelegate {
+ public:
+ explicit FakeClientCertificateDelegate(SSLClientAuthRequestorMock* requestor)
+ : requestor_(requestor) {}
+
+ ~FakeClientCertificateDelegate() override {
+ if (requestor_)
+ requestor_->CancelCertificateSelection();
+ }
+
+ // content::ClientCertificateDelegate implementation:
+ void ContinueWithCertificate(net::X509Certificate* cert) override {
+ requestor_->CertificateSelected(cert);
+ requestor_ = nullptr;
+ }
+
+ private:
+ scoped_refptr<SSLClientAuthRequestorMock> requestor_;
+
+ DISALLOW_COPY_AND_ASSIGN(FakeClientCertificateDelegate);
+};
+
+} // namespace
+
SSLClientAuthRequestorMock::SSLClientAuthRequestorMock(
net::URLRequest* request,
const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info)
@@ -14,3 +43,8 @@ SSLClientAuthRequestorMock::SSLClientAuthRequestorMock(
}
SSLClientAuthRequestorMock::~SSLClientAuthRequestorMock() {}
+
+scoped_ptr<content::ClientCertificateDelegate>
+SSLClientAuthRequestorMock::CreateDelegate() {
+ return make_scoped_ptr(new FakeClientCertificateDelegate(this));
+}
« no previous file with comments | « chrome/browser/ssl/ssl_client_auth_requestor_mock.h ('k') | chrome/browser/ssl/ssl_client_certificate_selector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698