Chromium Code Reviews| Index: content/browser/loader/navigation_resource_handler.cc |
| diff --git a/content/browser/loader/navigation_resource_handler.cc b/content/browser/loader/navigation_resource_handler.cc |
| index c9e212fdf82d8f97041514da70a62e2c7f4478ef..8010ff26170d270dc2465fba7b37f18869487d15 100644 |
| --- a/content/browser/loader/navigation_resource_handler.cc |
| +++ b/content/browser/loader/navigation_resource_handler.cc |
| @@ -94,16 +94,6 @@ bool NavigationResourceHandler::OnResponseStarted(ResourceResponse* response, |
| ResourceRequestInfoImpl* info = GetRequestInfo(); |
| - // If the MimeTypeResourceHandler intercepted this request and converted it |
| - // into a download, it will still call OnResponseStarted and immediately |
| - // cancel. Ignore the call; OnReadCompleted will happen shortly. |
| - // |
| - // TODO(davidben): Move the dispatch out of MimeTypeResourceHandler. Perhaps |
| - // all the way to the UI thread. Downloads, user certificates, etc., should be |
| - // dispatched at the navigation layer. |
| - if (info->IsDownload()) |
| - return true; |
| - |
| StreamContext* stream_context = |
| GetStreamContextForResourceContext(info->GetContext()); |
| writer_.InitializeStream(stream_context->registry(), |
| @@ -138,8 +128,21 @@ bool NavigationResourceHandler::OnResponseStarted(ResourceResponse* response, |
| // Make sure that the requests go through the throttle checks. Currently this |
| // does not work as the InterceptingResourceHandler is above us and hence it |
| // does not expect the old handler to defer the request. |
| - if (!info->is_stream()) |
| + // TODO(clamy): check if we should also make the downloads wait on the |
| + // NavigationThrottle checks be performed. |
| + if (!info->is_stream() && !info->IsDownload()) |
| *defer = true; |
| + |
| + // If the MimeTypeResourceHandler intercepted this request and converted it |
| + // into a download, it will still call OnResponseStarted and immediately |
| + // cancel. Ignore the call; OnReadCompleted will happen shortly. |
| + // |
| + // TODO(davidben): Move the dispatch out of MimeTypeResourceHandler. Perhaps |
| + // all the way to the UI thread. Downloads, user certificates, etc., should be |
| + // dispatched at the navigation layer. |
| + if (info->IsDownload()) |
| + return true; |
|
yzshen1
2016/12/06 17:57:37
This if-block doesn't seem necessary, we return tr
clamy
2016/12/16 17:07:14
Done. I've also removed the comment & TODO since I
|
| + |
| return true; |
| } |