Chromium Code Reviews| Index: chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc |
| diff --git a/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc b/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc |
| index a2f943e4c801cb410424d447e87c0e70912f6476..6a0a0ac5665c5c799f43446ed0c2d1fb7073d504 100644 |
| --- a/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc |
| +++ b/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc |
| @@ -65,6 +65,7 @@ |
| #include "content/public/browser/service_worker_context.h" |
| #include "content/public/browser/stream_info.h" |
| #include "content/public/browser/web_contents.h" |
| +#include "content/public/common/previews_state.h" |
| #include "content/public/common/resource_response.h" |
| #include "extensions/features/features.h" |
| #include "net/base/load_flags.h" |
| @@ -827,16 +828,23 @@ void ChromeResourceDispatcherHostDelegate::RequestComplete( |
| base::TimeTicks::Now() - url_request->creation_time())); |
| } |
| -bool ChromeResourceDispatcherHostDelegate::ShouldEnableLoFiMode( |
| +int ChromeResourceDispatcherHostDelegate::GetPreviewsState( |
| + int previews_state, |
| const net::URLRequest& url_request, |
| content::ResourceContext* resource_context) { |
| - ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); |
| - data_reduction_proxy::DataReductionProxyIOData* data_reduction_proxy_io_data = |
| - io_data->data_reduction_proxy_io_data(); |
| - |
| - if (data_reduction_proxy_io_data) |
| - return data_reduction_proxy_io_data->ShouldEnableLoFiMode(url_request); |
| - return false; |
| + if (previews_state & content::PREVIEWS_UNSPECIFIED) { |
|
RyanSturm
2016/12/03 00:28:11
Can you add a comment that previews_state is conte
megjablon
2016/12/06 00:59:18
Added the comment to resource_dispatcher_host_impl
|
| + ProfileIOData* io_data = |
| + ProfileIOData::FromResourceContext(resource_context); |
| + data_reduction_proxy::DataReductionProxyIOData* |
| + data_reduction_proxy_io_data = io_data->data_reduction_proxy_io_data(); |
| + |
| + if (data_reduction_proxy_io_data) |
| + return data_reduction_proxy_io_data->ShouldEnableLoFiMode(url_request) |
| + ? content::SERVER_LOFI_ON |
| + : content::PREVIEWS_OFF; |
| + return content::PREVIEWS_OFF; |
| + } |
| + return previews_state; |
| } |
| // static |