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

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: worker_common.js was missing a license header (also a rebase) Created 5 years, 9 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 f7c3c618d8c8ecbcf10cbc566c92548eba06dde1..b43f0d83a1f4ddc86f0c05d4018262863ce19ca3 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -116,6 +116,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"
@@ -1852,21 +1853,11 @@ 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);
@@ -1878,7 +1869,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,
@@ -1898,7 +1890,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;
}
}
@@ -1907,7 +1899,8 @@ void ChromeContentBrowserClient::SelectClientCertificate(
}
}
- chrome::ShowSSLClientCertificateSelector(tab, cert_request_info, callback);
+ chrome::ShowSSLClientCertificateSelector(web_contents, cert_request_info,
+ delegate.Pass());
}
void ChromeContentBrowserClient::AddCertificate(
« no previous file with comments | « chrome/browser/chrome_content_browser_client.h ('k') | chrome/browser/extensions/background_xhr_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698