Index: components/data_reduction_proxy/content/browser/content_lofi_decider.cc |
diff --git a/components/data_reduction_proxy/content/browser/content_lofi_decider.cc b/components/data_reduction_proxy/content/browser/content_lofi_decider.cc |
index c5e2b4daa0920501f6c7c13ed95d9d1665bd4a3c..e12985b3608aa5a8cdb62b11f31acbe5c4da9150 100644 |
--- a/components/data_reduction_proxy/content/browser/content_lofi_decider.cc |
+++ b/components/data_reduction_proxy/content/browser/content_lofi_decider.cc |
@@ -12,6 +12,7 @@ |
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_headers.h" |
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h" |
#include "content/public/browser/resource_request_info.h" |
+#include "content/public/common/previews_state.h" |
#include "net/base/load_flags.h" |
#include "net/http/http_request_headers.h" |
#include "net/url_request/url_request.h" |
@@ -32,8 +33,10 @@ bool ContentLoFiDecider::IsUsingLoFiMode(const net::URLRequest& request) const { |
params::IsLoFiOnViaFlags() || params::IsIncludedInLoFiEnabledFieldTrial(); |
// Return if the user is using Lo-Fi and not part of the "Control" group. |
- if (request_info) |
- return request_info->IsUsingLoFi() && lofi_enabled_via_flag_or_field_trial; |
+ if (request_info) { |
+ return (request_info->GetPreviewsState() & content::SERVER_LOFI_ON) && |
+ lofi_enabled_via_flag_or_field_trial; |
+ } |
return false; |
} |
@@ -108,7 +111,7 @@ void ContentLoFiDecider::MaybeSetAcceptTransformHeader( |
if (accept_transform_value.empty()) |
return; |
- if (!request_info->IsUsingLoFi()) |
+ if (!(request_info->GetPreviewsState() & content::SERVER_LOFI_ON)) |
accept_transform_value += base::StringPrintf(";%s", if_heavy_qualifier()); |
headers->SetHeader(chrome_proxy_accept_transform_header(), |
@@ -179,8 +182,10 @@ bool ContentLoFiDecider::ShouldRecordLoFiUMA( |
content::ResourceRequestInfo::ForRequest(&request); |
// User is not using Lo-Fi. |
- if (!request_info || !request_info->IsUsingLoFi()) |
+ if (!request_info || |
+ !(request_info->GetPreviewsState() & content::SERVER_LOFI_ON)) { |
return false; |
+ } |
return params::IsIncludedInLoFiEnabledFieldTrial() || |
params::IsIncludedInLoFiControlFieldTrial(); |