Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Unified Diff: components/data_reduction_proxy/content/browser/content_lofi_decider.cc

Issue 2484633004: Change Lo-Fi bool to bitmask to support multiple Previews types (Closed)
Patch Set: fix ContentResourceProviderTest Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 afe030a7610ceef566ee23ead0216037d3a590d3..addf63b9ed1a91e8e1f4d6ca73d028c080b5d81c 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 "content/public/common/resource_type.h"
#include "net/base/load_flags.h"
#include "net/http/http_request_headers.h"
@@ -33,8 +34,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;
}
@@ -109,7 +112,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(),
@@ -180,8 +183,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();

Powered by Google App Engine
This is Rietveld 408576698