| 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/ui/views/ssl_client_certificate_selector.h" | 5 #include "chrome/browser/ui/views/ssl_client_certificate_selector.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/certificate_viewer.h" | 10 #include "chrome/browser/certificate_viewer.h" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 bool SSLClientCertificateSelector::Cancel() { | 182 bool SSLClientCertificateSelector::Cancel() { |
| 183 DVLOG(1) << __FUNCTION__; | 183 DVLOG(1) << __FUNCTION__; |
| 184 StopObserving(); | 184 StopObserving(); |
| 185 CertificateSelected(NULL); | 185 CertificateSelected(NULL); |
| 186 return true; | 186 return true; |
| 187 } | 187 } |
| 188 | 188 |
| 189 bool SSLClientCertificateSelector::Accept() { | 189 bool SSLClientCertificateSelector::Accept() { |
| 190 DVLOG(1) << __FUNCTION__; | 190 DVLOG(1) << __FUNCTION__; |
| 191 scoped_refptr<net::X509Certificate> cert = GetSelectedCert(); | 191 scoped_refptr<net::X509Certificate> cert = GetSelectedCert(); |
| 192 if (cert) { | 192 if (cert.get()) { |
| 193 // Remove the observer before we try unlocking, otherwise we might act on a | 193 // Remove the observer before we try unlocking, otherwise we might act on a |
| 194 // notification while waiting for the unlock dialog, causing us to delete | 194 // notification while waiting for the unlock dialog, causing us to delete |
| 195 // ourself before the Unlocked callback gets called. | 195 // ourself before the Unlocked callback gets called. |
| 196 StopObserving(); | 196 StopObserving(); |
| 197 #if defined(USE_NSS) | 197 #if defined(USE_NSS) |
| 198 chrome::UnlockCertSlotIfNecessary( | 198 chrome::UnlockCertSlotIfNecessary( |
| 199 cert, | 199 cert.get(), |
| 200 chrome::kCryptoModulePasswordClientAuth, | 200 chrome::kCryptoModulePasswordClientAuth, |
| 201 cert_request_info()->host_and_port, | 201 cert_request_info()->host_and_port, |
| 202 GetWidget()->GetNativeView(), | 202 GetWidget()->GetNativeView(), |
| 203 base::Bind(&SSLClientCertificateSelector::Unlocked, | 203 base::Bind(&SSLClientCertificateSelector::Unlocked, |
| 204 base::Unretained(this), | 204 base::Unretained(this), |
| 205 cert)); | 205 cert)); |
| 206 #else | 206 #else |
| 207 Unlocked(cert); | 207 Unlocked(cert); |
| 208 #endif | 208 #endif |
| 209 return false; // Unlocked() will close the dialog. | 209 return false; // Unlocked() will close the dialog. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 const net::HttpNetworkSession* network_session, | 277 const net::HttpNetworkSession* network_session, |
| 278 net::SSLCertRequestInfo* cert_request_info, | 278 net::SSLCertRequestInfo* cert_request_info, |
| 279 const chrome::SelectCertificateCallback& callback) { | 279 const chrome::SelectCertificateCallback& callback) { |
| 280 DVLOG(1) << __FUNCTION__ << " " << contents; | 280 DVLOG(1) << __FUNCTION__ << " " << contents; |
| 281 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 281 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 282 (new SSLClientCertificateSelector( | 282 (new SSLClientCertificateSelector( |
| 283 contents, network_session, cert_request_info, callback))->Init(); | 283 contents, network_session, cert_request_info, callback))->Init(); |
| 284 } | 284 } |
| 285 | 285 |
| 286 } // namespace chrome | 286 } // namespace chrome |
| OLD | NEW |