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

Unified Diff: chrome/browser/chrome_content_browser_client.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/chrome_content_browser_client.cc
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index cf63aa7cf1ec233a8427de64bbba0c5e8ce9d4c0..7e4430a8bd758cb008a6a4f6e80f507f1bf1662f 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -111,6 +111,7 @@
#include "content/public/browser/browser_url_handler.h"
#include "content/public/browser/child_process_data.h"
#include "content/public/browser/child_process_security_policy.h"
+#include "content/public/browser/client_certificate_delegate.h"
#include "content/public/browser/permission_type.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
@@ -1817,24 +1818,15 @@ void ChromeContentBrowserClient::AllowCertificateError(
}
void ChromeContentBrowserClient::SelectClientCertificate(
- int render_process_id,
- int render_frame_id,
+ content::WebContents* web_contents,
net::SSLCertRequestInfo* cert_request_info,
- const base::Callback<void(net::X509Certificate*)>& callback) {
- content::RenderFrameHost* rfh = content::RenderFrameHost::FromID(
- render_process_id, render_frame_id);
- WebContents* tab = WebContents::FromRenderFrameHost(rfh);
- if (!tab) {
- // TODO(davidben): This makes the request hang, but returning no certificate
- // also breaks. It should abort the request. See https://crbug.com/417092
- return;
- }
-
+ scoped_ptr<content::ClientCertificateDelegate> delegate) {
prerender::PrerenderContents* prerender_contents =
- prerender::PrerenderContents::FromWebContents(tab);
+ prerender::PrerenderContents::FromWebContents(web_contents);
if (prerender_contents) {
prerender_contents->Destroy(
prerender::FINAL_STATUS_SSL_CLIENT_CERTIFICATE_REQUESTED);
+ delegate->CancelCertificateSelection();
return;
}
@@ -1843,7 +1835,8 @@ void ChromeContentBrowserClient::SelectClientCertificate(
<< "Invalid URL string: https://"
<< cert_request_info->host_and_port.ToString();
- Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext());
+ Profile* profile =
+ Profile::FromBrowserContext(web_contents->GetBrowserContext());
scoped_ptr<base::Value> filter =
profile->GetHostContentSettingsMap()->GetWebsiteSetting(
requesting_url,
@@ -1863,7 +1856,7 @@ void ChromeContentBrowserClient::SelectClientCertificate(
for (size_t i = 0; i < all_client_certs.size(); ++i) {
if (CertMatchesFilter(*all_client_certs[i].get(), *filter_dict)) {
// Use the first certificate that is matched by the filter.
- callback.Run(all_client_certs[i].get());
+ delegate->ContinueWithCertificate(all_client_certs[i].get());
return;
}
}
@@ -1872,7 +1865,8 @@ void ChromeContentBrowserClient::SelectClientCertificate(
}
}
- chrome::ShowSSLClientCertificateSelector(tab, cert_request_info, callback);
+ chrome::ShowSSLClientCertificateSelector(web_contents, cert_request_info,
+ delegate.Pass());
}
void ChromeContentBrowserClient::AddCertificate(

Powered by Google App Engine
This is Rietveld 408576698