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

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: clean up comments Created 4 years 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 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();

Powered by Google App Engine
This is Rietveld 408576698