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

Side by Side 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: extension test Created 5 years, 10 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/ssl/ssl_client_auth_requestor_mock.h" 5 #include "chrome/browser/ssl/ssl_client_auth_requestor_mock.h"
6 6
7 #include "base/macros.h"
8 #include "content/public/browser/client_certificate_delegate.h"
7 #include "net/ssl/ssl_cert_request_info.h" 9 #include "net/ssl/ssl_cert_request_info.h"
8 #include "net/url_request/url_request.h" 10 #include "net/url_request/url_request.h"
9 11
12 namespace {
13
14 class MockClientCertificateDelegate
15 : public content::ClientCertificateDelegate {
16 public:
17 explicit MockClientCertificateDelegate(SSLClientAuthRequestorMock* requestor)
18 : requestor_(requestor) {}
19
20 // content::ClientCertificateDelegate implementation:
21 void ContinueWithCertificate(net::X509Certificate* cert) override {
22 requestor_->CertificateSelected(cert);
23 }
24
25 void CancelCertificateSelection() override {
26 requestor_->CancelCertificateSelection();
27 }
28
29 private:
30 scoped_refptr<SSLClientAuthRequestorMock> requestor_;
31
32 DISALLOW_COPY_AND_ASSIGN(MockClientCertificateDelegate);
33 };
34
35 } // namespace
36
10 SSLClientAuthRequestorMock::SSLClientAuthRequestorMock( 37 SSLClientAuthRequestorMock::SSLClientAuthRequestorMock(
11 net::URLRequest* request, 38 net::URLRequest* request,
12 const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info) 39 const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info)
13 : cert_request_info_(cert_request_info) { 40 : cert_request_info_(cert_request_info) {
14 } 41 }
15 42
16 SSLClientAuthRequestorMock::~SSLClientAuthRequestorMock() {} 43 SSLClientAuthRequestorMock::~SSLClientAuthRequestorMock() {}
44
45 scoped_ptr<content::ClientCertificateDelegate>
46 SSLClientAuthRequestorMock::CreateDelegate() {
47 return scoped_ptr<content::ClientCertificateDelegate>(
48 new MockClientCertificateDelegate(this));
49 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698