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

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: mismerge 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 4f7e59139d26aa37ae7abc868705204dc7a39133..dc2039db49dbe3163d29439984958e2a8e6e5331 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -113,6 +113,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"
@@ -1845,24 +1846,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();
sky 2015/02/20 21:32:29 Since the delegate is going to be deleted in the r
davidben 2015/02/24 22:38:40 Switched the delegate to trigger cancel in the des
return;
}
@@ -1871,7 +1863,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,
@@ -1891,7 +1884,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;
}
}
@@ -1900,7 +1893,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