Chromium Code Reviews| Index: content/child/web_url_loader_impl.cc |
| diff --git a/content/child/web_url_loader_impl.cc b/content/child/web_url_loader_impl.cc |
| index ba560b65593dff68bbdce1f7e24b8028acd8cb12..74eaae995df4bf52f082a6d8bf3e1f1eb03e35f4 100644 |
| --- a/content/child/web_url_loader_impl.cc |
| +++ b/content/child/web_url_loader_impl.cc |
| @@ -244,7 +244,7 @@ class WebURLLoaderImpl::Context : public base::RefCounted<Context>, |
| virtual ~Context() {} |
| // We can optimize the handling of data URLs in most cases. |
| - bool CanHandleDataURL(const GURL& url) const; |
| + bool IsHandlableDataURLRequest() const; |
| void HandleDataURL(); |
| WebURLLoaderImpl* loader_; |
| @@ -312,7 +312,7 @@ void WebURLLoaderImpl::Context::Start(const WebURLRequest& request, |
| request_ = request; // Save the request. |
| GURL url = request.url(); |
| - if (url.SchemeIs("data") && CanHandleDataURL(url)) { |
| + if (IsHandlableDataURLRequest()) { |
|
eseidel
2014/09/04 16:31:25
I would have used the active voice "CanHandleDataU
tyoshino (SeeGerritForStatus)
2014/09/05 14:05:09
In the name, I also wanted to mean that we're chec
|
| if (sync_load_response) { |
| // This is a sync load. Do the work now. |
| sync_load_response->url = url; |
| @@ -656,8 +656,15 @@ void WebURLLoaderImpl::Context::OnCompletedRequest( |
| } |
| } |
| -bool WebURLLoaderImpl::Context::CanHandleDataURL(const GURL& url) const { |
| - DCHECK(url.SchemeIs("data")); |
| +bool WebURLLoaderImpl::Context::IsHandlableDataURLRequest() const { |
| + GURL url = request_.url(); |
| + if (!url.SchemeIs("data")) |
| + return false; |
| + |
| + // The fast paths for data URL, Start() and HandleDataURL(), don't support |
| + // the downloadToFile option. |
| + if (request_.downloadToFile()) |
| + return false; |
| // Optimize for the case where we can handle a data URL locally. We must |
| // skip this for data URLs targetted at frames since those could trigger a |
| @@ -679,7 +686,7 @@ bool WebURLLoaderImpl::Context::CanHandleDataURL(const GURL& url) const { |
| return true; |
| std::string mime_type, unused_charset; |
| - if (net::DataURL::Parse(url, &mime_type, &unused_charset, NULL) && |
| + if (net::DataURL::Parse(request_.url(), &mime_type, &unused_charset, NULL) && |
| net::IsSupportedMimeType(mime_type)) |
| return true; |