| 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/grit/generated_resources.h" | 10 #include "chrome/grit/generated_resources.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 void ShowSSLClientCertificateSelector( | 98 void ShowSSLClientCertificateSelector( |
| 99 content::WebContents* contents, | 99 content::WebContents* contents, |
| 100 net::SSLCertRequestInfo* cert_request_info, | 100 net::SSLCertRequestInfo* cert_request_info, |
| 101 scoped_ptr<content::ClientCertificateDelegate> delegate) { | 101 scoped_ptr<content::ClientCertificateDelegate> delegate) { |
| 102 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 102 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 103 | 103 |
| 104 // Not all WebContentses can show modal dialogs. | 104 // Not all WebContentses can show modal dialogs. |
| 105 // | 105 // |
| 106 // TODO(davidben): Move this hook to the WebContentsDelegate and only try to | 106 // TODO(davidben): Move this hook to the WebContentsDelegate and only try to |
| 107 // show a dialog in Browser's implementation. https://crbug.com/456255 | 107 // show a dialog in Browser's implementation. https://crbug.com/456255 |
| 108 if (web_modal::PopupManager::FromWebContents(contents) == nullptr) | 108 if (!SSLClientCertificateSelector::CanShow(contents)) |
| 109 return; | 109 return; |
| 110 | 110 |
| 111 SSLClientCertificateSelector* selector = new SSLClientCertificateSelector( | 111 SSLClientCertificateSelector* selector = new SSLClientCertificateSelector( |
| 112 contents, cert_request_info, delegate.Pass()); | 112 contents, cert_request_info, delegate.Pass()); |
| 113 selector->Init(); | 113 selector->Init(); |
| 114 selector->Show(); | 114 selector->Show(); |
| 115 } | 115 } |
| 116 | 116 |
| 117 } // namespace chrome | 117 } // namespace chrome |
| OLD | NEW |