Chromium Code Reviews| Index: chromecast/browser/cast_content_browser_client.cc |
| diff --git a/chromecast/browser/cast_content_browser_client.cc b/chromecast/browser/cast_content_browser_client.cc |
| index 9793e68b6f0885a7d5025d6f78afd7a83e6cbe08..671b734e9f70d3df0c00f8ba86d6eb2721f0bd88 100644 |
| --- a/chromecast/browser/cast_content_browser_client.cc |
| +++ b/chromecast/browser/cast_content_browser_client.cc |
| @@ -32,6 +32,7 @@ |
| #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/browser/web_contents.h" |
| #include "content/public/common/content_descriptors.h" |
| #include "content/public/common/content_switches.h" |
| #include "content/public/common/url_constants.h" |
| @@ -195,7 +196,7 @@ void CastContentBrowserClient::AllowCertificateError( |
| } |
| void CastContentBrowserClient::SelectClientCertificate( |
| - WebContents* web_contents, |
| + content::WebContents* web_contents, |
| net::SSLCertRequestInfo* cert_request_info, |
| scoped_ptr<content::ClientCertificateDelegate> delegate) { |
| GURL requesting_url("https://" + cert_request_info->host_and_port.ToString()); |
| @@ -203,7 +204,6 @@ void CastContentBrowserClient::SelectClientCertificate( |
| if (!requesting_url.is_valid()) { |
| LOG(ERROR) << "Invalid URL string: " |
| << requesting_url.possibly_invalid_spec(); |
| - delegate->SelectClientCertificate(nullptr); |
| return; |
| } |
| @@ -217,31 +217,29 @@ void CastContentBrowserClient::SelectClientCertificate( |
| // |
| // TODO(davidben): Stop using child ID to identify an app. |
| DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| - content::BrowserThread::PostTaskAndReplyWithResult( |
| + content::BrowserThread::PostTask( |
| 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())); |
| + web_contents->GetRenderProcessHost()->GetID(), |
| + base::Passed(&delegate))); |
| } |
| -net::X509Certificate* |
| -CastContentBrowserClient::SelectClientCertificateOnIOThread( |
| +void CastContentBrowserClient::SelectClientCertificateOnIOThread( |
| GURL requesting_url, |
| - int render_process_id) { |
| + int render_process_id, |
| + scoped_ptr<content::ClientCertificateDelegate> delegate) { |
| DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| CastNetworkDelegate* network_delegate = |
| url_request_context_factory_->app_network_delegate(); |
| if (network_delegate->IsWhitelisted(requesting_url, |
| render_process_id, false)) { |
| - return CastNetworkDelegate::DeviceCert(); |
| + delegate->ContinueWithCertificate(CastNetworkDelegate::DeviceCert()); |
|
davidben
2015/03/11 22:57:59
This won't work. It has to be called on the IO thr
davidben
2015/03/11 22:59:28
Sorry, I meant UI thread.
gunsch
2015/03/11 23:05:59
I can use base::Owned, but it's a little ugly (rel
davidben
2015/03/11 23:26:38
Yeah, the release() bugged me in the other place I
|
| } else { |
| LOG(ERROR) << "Invalid host for client certificate request: " |
| << requesting_url.host() |
| << " with render_process_id: " |
| << render_process_id; |
| - return NULL; |
| } |
| } |