Chromium Code Reviews| Index: content/browser/loader/resource_dispatcher_host_impl.cc |
| diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc |
| index 11c590b98aa2bec8ae5c790b2321705d30bdfee8..efa9d85b5565c27d293f169fe47428ff767281b2 100644 |
| --- a/content/browser/loader/resource_dispatcher_host_impl.cc |
| +++ b/content/browser/loader/resource_dispatcher_host_impl.cc |
| @@ -49,7 +49,8 @@ |
| #include "content/browser/loader/async_revalidation_manager.h" |
| #include "content/browser/loader/cross_site_resource_handler.h" |
| #include "content/browser/loader/detachable_resource_handler.h" |
| -#include "content/browser/loader/mime_type_resource_handler.h" |
| +#include "content/browser/loader/intercepting_resource_handler.h" |
| +#include "content/browser/loader/mime_sniffing_resource_handler.h" |
| #include "content/browser/loader/navigation_resource_handler.h" |
| #include "content/browser/loader/navigation_resource_throttle.h" |
| #include "content/browser/loader/navigation_url_loader_impl_core.h" |
| @@ -1686,9 +1687,12 @@ ResourceDispatcherHostImpl::AddStandardHandlers( |
| #if defined(ENABLE_PLUGINS) |
| plugin_service = PluginService::GetInstance(); |
| #endif |
| - // Insert a buffered event handler before the actual one. |
| - handler.reset(new MimeTypeResourceHandler(std::move(handler), this, |
| - plugin_service, request)); |
| + |
| + // The InterceptingResourceHandler will replace its next handler with an |
| + // appropriate one based on the MIME type of the response if needed. It |
| + // should be placed at the end of the chain, just before |handler|. |
| + handler.reset(new InterceptingResourceHandler(std::move(handler), this, |
| + plugin_service, request)); |
| ScopedVector<ResourceThrottle> throttles; |
| @@ -1720,6 +1724,9 @@ ResourceDispatcherHostImpl::AddStandardHandlers( |
| handler.reset(new ThrottlingResourceHandler(std::move(handler), request, |
| std::move(throttles))); |
| + // Insert a buffered event handler to sniff the mime type first. |
| + handler.reset(new MimeSniffingResourceHandler(std::move(handler), request)); |
|
asanka
2016/06/23 02:30:13
Note that this ResourceHandler is special. Every r
clamy
2016/06/28 16:20:41
Added documentation about this behavior in the com
|
| + |
| return handler; |
| } |