summaryrefslogtreecommitdiffstats
path: root/chromecast/browser
diff options
context:
space:
mode:
authordavidben <davidben@chromium.org>2015-03-11 12:42:19 -0700
committerCommit bot <commit-bot@chromium.org>2015-03-11 19:43:57 +0000
commit3b8455ae75609ee9e91e3af240882785d9942359 (patch)
tree2c35e7bb09f7f4ba820314a9224d1422cd50dddf /chromecast/browser
parentc0844e78ad3dd640f6a2a84f57681ead31647b07 (diff)
downloadchromium_src-3b8455ae75609ee9e91e3af240882785d9942359.zip
chromium_src-3b8455ae75609ee9e91e3af240882785d9942359.tar.gz
chromium_src-3b8455ae75609ee9e91e3af240882785d9942359.tar.bz2
Cancel client auth requests when not promptable.
Currently they hang (holding the cache lock) or crash. This plumbs through a dedicated delegate interface. If the delegate is destroyed with no notification, the request is aborted. This is distinct from affirmatively continuing with no certificat (what you get from pressing cancel). This is extremely bizarre UI, but this CL does not attempt to address the existing UI being odd. This fixes the following: - Closing a tab with a client auth prompt acts as if you affirmatively selected to continue without a cert. - A SharedWorker requesting client auth hangs the request. - Hitting client auth in an extension background page crashes. BUG=417092,410967 Review URL: https://codereview.chromium.org/859213006 Cr-Commit-Position: refs/heads/master@{#320117}
Diffstat (limited to 'chromecast/browser')
-rw-r--r--chromecast/browser/cast_content_browser_client.cc24
-rw-r--r--chromecast/browser/cast_content_browser_client.h5
2 files changed, 14 insertions, 15 deletions
diff --git a/chromecast/browser/cast_content_browser_client.cc b/chromecast/browser/cast_content_browser_client.cc
index 56a8250..9793e68 100644
--- a/chromecast/browser/cast_content_browser_client.cc
+++ b/chromecast/browser/cast_content_browser_client.cc
@@ -29,6 +29,7 @@
#include "components/network_hints/browser/network_hints_message_filter.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/certificate_request_result_type.h"
+#include "content/public/browser/client_certificate_delegate.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/resource_dispatcher_host.h"
#include "content/public/common/content_descriptors.h"
@@ -194,16 +195,15 @@ void CastContentBrowserClient::AllowCertificateError(
}
void CastContentBrowserClient::SelectClientCertificate(
- int render_process_id,
- int render_view_id,
+ WebContents* web_contents,
net::SSLCertRequestInfo* cert_request_info,
- const base::Callback<void(net::X509Certificate*)>& callback) {
+ scoped_ptr<content::ClientCertificateDelegate> delegate) {
GURL requesting_url("https://" + cert_request_info->host_and_port.ToString());
if (!requesting_url.is_valid()) {
LOG(ERROR) << "Invalid URL string: "
<< requesting_url.possibly_invalid_spec();
- callback.Run(NULL);
+ delegate->SelectClientCertificate(nullptr);
return;
}
@@ -214,16 +214,16 @@ void CastContentBrowserClient::SelectClientCertificate(
// it, because CastNetworkDelegate is bound to the IO thread.
// Subsequently, the callback must then itself be performed back here
// on the UI thread.
+ //
+ // TODO(davidben): Stop using child ID to identify an app.
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
content::BrowserThread::PostTaskAndReplyWithResult(
- content::BrowserThread::IO,
- FROM_HERE,
- base::Bind(
- &CastContentBrowserClient::SelectClientCertificateOnIOThread,
- base::Unretained(this),
- requesting_url,
- render_process_id),
- callback);
+ content::BrowserThread::IO, FROM_HERE,
+ base::Bind(&CastContentBrowserClient::SelectClientCertificateOnIOThread,
+ base::Unretained(this), requesting_url,
+ web_contents->GetRenderProcessHost()->GetID()),
+ base::Bind(&content::ClientCertificateDelegate::ContinueWithCertificate,
+ delegate.Pass()));
}
net::X509Certificate*
diff --git a/chromecast/browser/cast_content_browser_client.h b/chromecast/browser/cast_content_browser_client.h
index ace7286..4184674 100644
--- a/chromecast/browser/cast_content_browser_client.h
+++ b/chromecast/browser/cast_content_browser_client.h
@@ -68,10 +68,9 @@ class CastContentBrowserClient: public content::ContentBrowserClient {
const base::Callback<void(bool)>& callback,
content::CertificateRequestResultType* result) override;
void 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) override;
+ scoped_ptr<content::ClientCertificateDelegate> delegate) override;
bool CanCreateWindow(
const GURL& opener_url,
const GURL& opener_top_level_frame_url,