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

Unified Diff: chrome/browser/ui/views/ssl_client_certificate_selector.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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/ssl_client_certificate_selector.cc
diff --git a/chrome/browser/ui/views/ssl_client_certificate_selector.cc b/chrome/browser/ui/views/ssl_client_certificate_selector.cc
index de31ce8f02a3c46810ae1a838aa29b848d1bfbf0..4ae8bfe97c8354cbabbe04a8b30a6a33f788ec1d 100644
--- a/chrome/browser/ui/views/ssl_client_certificate_selector.cc
+++ b/chrome/browser/ui/views/ssl_client_certificate_selector.cc
@@ -10,7 +10,9 @@
#include "chrome/browser/certificate_viewer.h"
#include "chrome/grit/generated_resources.h"
#include "components/constrained_window/constrained_window_views.h"
+#include "components/web_modal/popup_manager.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/client_certificate_delegate.h"
#include "content/public/browser/web_contents.h"
#include "net/cert/x509_certificate.h"
#include "net/ssl/ssl_cert_request_info.h"
@@ -83,9 +85,10 @@ void CertificateSelectorTableModel::SetObserver(
SSLClientCertificateSelector::SSLClientCertificateSelector(
content::WebContents* web_contents,
const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info,
- const chrome::SelectCertificateCallback& callback)
+ scoped_ptr<content::ClientCertificateDelegate> delegate)
: SSLClientAuthObserver(web_contents->GetBrowserContext(),
- cert_request_info, callback),
+ cert_request_info,
+ delegate.Pass()),
model_(new CertificateSelectorTableModel(cert_request_info.get())),
web_contents_(web_contents),
table_(NULL),
@@ -212,6 +215,13 @@ bool SSLClientCertificateSelector::Accept() {
return false;
}
+bool SSLClientCertificateSelector::Close() {
+ DVLOG(1) << __FUNCTION__;
+ StopObserving();
+ CancelCertificateSelection();
+ return true;
+}
+
views::View* SSLClientCertificateSelector::GetInitiallyFocusedView() {
return table_;
}
@@ -275,11 +285,21 @@ namespace chrome {
void ShowSSLClientCertificateSelector(
content::WebContents* contents,
net::SSLCertRequestInfo* cert_request_info,
- const chrome::SelectCertificateCallback& callback) {
+ scoped_ptr<content::ClientCertificateDelegate> delegate) {
DVLOG(1) << __FUNCTION__ << " " << contents;
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- (new SSLClientCertificateSelector(
- contents, cert_request_info, callback))->Init();
+
+ // Not all WebContentses can show modal dialogs.
+ //
+ // TODO(davidben): Move this hook to the WebContentsDelegate and only try to
+ // show a dialog in Browser's implementation. https://crbug.com/456255
+ if (web_modal::PopupManager::FromWebContents(contents) == nullptr) {
+ delegate->CancelCertificateSelection();
+ return;
+ }
+
+ (new SSLClientCertificateSelector(contents, cert_request_info,
+ delegate.Pass()))->Init();
}
} // namespace chrome

Powered by Google App Engine
This is Rietveld 408576698