OLD | NEW |
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_observer.h" | 5 #include "chrome/browser/ssl/ssl_client_auth_observer.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
13 #include "content/public/browser/client_certificate_delegate.h" | 13 #include "content/public/browser/client_certificate_delegate.h" |
14 #include "content/public/browser/notification_service.h" | 14 #include "content/public/browser/notification_service.h" |
15 #include "net/cert/x509_certificate.h" | 15 #include "net/cert/x509_certificate.h" |
16 #include "net/ssl/ssl_cert_request_info.h" | 16 #include "net/ssl/ssl_cert_request_info.h" |
17 | 17 |
18 using content::BrowserThread; | 18 using content::BrowserThread; |
19 | 19 |
20 typedef std::pair<net::SSLCertRequestInfo*, net::X509Certificate*> CertDetails; | 20 typedef std::pair<net::SSLCertRequestInfo*, net::X509Certificate*> CertDetails; |
21 | 21 |
22 SSLClientAuthObserver::SSLClientAuthObserver( | 22 SSLClientAuthObserver::SSLClientAuthObserver( |
23 const content::BrowserContext* browser_context, | 23 const content::BrowserContext* browser_context, |
24 const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info, | 24 const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info, |
25 scoped_ptr<content::ClientCertificateDelegate> delegate) | 25 scoped_ptr<content::ClientCertificateDelegate> delegate) |
26 : browser_context_(browser_context), | 26 : browser_context_(browser_context), |
27 cert_request_info_(cert_request_info), | 27 cert_request_info_(cert_request_info), |
28 delegate_(delegate.Pass()) { | 28 delegate_(std::move(delegate)) {} |
29 } | |
30 | 29 |
31 SSLClientAuthObserver::~SSLClientAuthObserver() { | 30 SSLClientAuthObserver::~SSLClientAuthObserver() { |
32 } | 31 } |
33 | 32 |
34 void SSLClientAuthObserver::CertificateSelected( | 33 void SSLClientAuthObserver::CertificateSelected( |
35 net::X509Certificate* certificate) { | 34 net::X509Certificate* certificate) { |
36 if (!delegate_) | 35 if (!delegate_) |
37 return; | 36 return; |
38 | 37 |
39 // Stop listening now that the delegate has been resolved. This is also to | 38 // Stop listening now that the delegate has been resolved. This is also to |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 86 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
88 notification_registrar_.Add( | 87 notification_registrar_.Add( |
89 this, chrome::NOTIFICATION_SSL_CLIENT_AUTH_CERT_SELECTED, | 88 this, chrome::NOTIFICATION_SSL_CLIENT_AUTH_CERT_SELECTED, |
90 content::Source<content::BrowserContext>(browser_context_)); | 89 content::Source<content::BrowserContext>(browser_context_)); |
91 } | 90 } |
92 | 91 |
93 void SSLClientAuthObserver::StopObserving() { | 92 void SSLClientAuthObserver::StopObserving() { |
94 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 93 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
95 notification_registrar_.RemoveAll(); | 94 notification_registrar_.RemoveAll(); |
96 } | 95 } |
OLD | NEW |