| 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 "content/browser/ssl/ssl_client_auth_handler.h" | 5 #include "content/browser/ssl/ssl_client_auth_handler.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" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 } | 38 } |
| 39 } | 39 } |
| 40 | 40 |
| 41 // ClientCertificateDelegate implementation: | 41 // ClientCertificateDelegate implementation: |
| 42 void ContinueWithCertificate(net::X509Certificate* cert) override { | 42 void ContinueWithCertificate(net::X509Certificate* cert) override { |
| 43 DCHECK(!continue_called_); | 43 DCHECK(!continue_called_); |
| 44 continue_called_ = true; | 44 continue_called_ = true; |
| 45 BrowserThread::PostTask( | 45 BrowserThread::PostTask( |
| 46 BrowserThread::IO, FROM_HERE, | 46 BrowserThread::IO, FROM_HERE, |
| 47 base::Bind(&SSLClientAuthHandler::ContinueWithCertificate, handler_, | 47 base::Bind(&SSLClientAuthHandler::ContinueWithCertificate, handler_, |
| 48 make_scoped_refptr(cert))); | 48 base::RetainedRef(cert))); |
| 49 } | 49 } |
| 50 | 50 |
| 51 private: | 51 private: |
| 52 base::WeakPtr<SSLClientAuthHandler> handler_; | 52 base::WeakPtr<SSLClientAuthHandler> handler_; |
| 53 bool continue_called_; | 53 bool continue_called_; |
| 54 | 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(ClientCertificateDelegateImpl); | 55 DISALLOW_COPY_AND_ASSIGN(ClientCertificateDelegateImpl); |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 void SelectCertificateOnUIThread( | 58 void SelectCertificateOnUIThread( |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 cert_request_info_->client_certs.empty()) { | 171 cert_request_info_->client_certs.empty()) { |
| 172 // No need to query the user if there are no certs to choose from. | 172 // No need to query the user if there are no certs to choose from. |
| 173 // | 173 // |
| 174 // TODO(davidben): The WebContents-less check on the UI thread should come | 174 // TODO(davidben): The WebContents-less check on the UI thread should come |
| 175 // before checking ClientCertStore; ClientCertStore itself should probably | 175 // before checking ClientCertStore; ClientCertStore itself should probably |
| 176 // be handled by the embedder (https://crbug.com/394131), especially since | 176 // be handled by the embedder (https://crbug.com/394131), especially since |
| 177 // this doesn't work on Android (https://crbug.com/345641). | 177 // this doesn't work on Android (https://crbug.com/345641). |
| 178 BrowserThread::PostTask( | 178 BrowserThread::PostTask( |
| 179 BrowserThread::IO, FROM_HERE, | 179 BrowserThread::IO, FROM_HERE, |
| 180 base::Bind(&SSLClientAuthHandler::ContinueWithCertificate, | 180 base::Bind(&SSLClientAuthHandler::ContinueWithCertificate, |
| 181 weak_factory_.GetWeakPtr(), | 181 weak_factory_.GetWeakPtr(), nullptr)); |
| 182 scoped_refptr<net::X509Certificate>())); | |
| 183 return; | 182 return; |
| 184 } | 183 } |
| 185 | 184 |
| 186 int render_process_host_id; | 185 int render_process_host_id; |
| 187 int render_frame_host_id; | 186 int render_frame_host_id; |
| 188 if (!ResourceRequestInfo::ForRequest(request_)->GetAssociatedRenderFrame( | 187 if (!ResourceRequestInfo::ForRequest(request_)->GetAssociatedRenderFrame( |
| 189 &render_process_host_id, &render_frame_host_id)) { | 188 &render_process_host_id, &render_frame_host_id)) { |
| 190 NOTREACHED(); | 189 NOTREACHED(); |
| 191 BrowserThread::PostTask( | 190 BrowserThread::PostTask( |
| 192 BrowserThread::IO, FROM_HERE, | 191 BrowserThread::IO, FROM_HERE, |
| 193 base::Bind(&SSLClientAuthHandler::CancelCertificateSelection, | 192 base::Bind(&SSLClientAuthHandler::CancelCertificateSelection, |
| 194 weak_factory_.GetWeakPtr())); | 193 weak_factory_.GetWeakPtr())); |
| 195 return; | 194 return; |
| 196 } | 195 } |
| 197 | 196 |
| 198 BrowserThread::PostTask( | 197 BrowserThread::PostTask( |
| 199 BrowserThread::UI, FROM_HERE, | 198 BrowserThread::UI, FROM_HERE, |
| 200 base::Bind(&SelectCertificateOnUIThread, render_process_host_id, | 199 base::Bind(&SelectCertificateOnUIThread, render_process_host_id, |
| 201 render_frame_host_id, cert_request_info_, | 200 render_frame_host_id, base::RetainedRef(cert_request_info_), |
| 202 weak_factory_.GetWeakPtr())); | 201 weak_factory_.GetWeakPtr())); |
| 203 } | 202 } |
| 204 | 203 |
| 205 } // namespace content | 204 } // namespace content |
| OLD | NEW |