| Index: components/data_reduction_proxy/content/browser/content_data_reduction_proxy_lofi_helper.cc
|
| diff --git a/components/data_reduction_proxy/content/browser/content_data_reduction_proxy_lofi_helper.cc b/components/data_reduction_proxy/content/browser/content_data_reduction_proxy_lofi_helper.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..9458d828c406315d1d436d9fb7d9691185fb1a39
|
| --- /dev/null
|
| +++ b/components/data_reduction_proxy/content/browser/content_data_reduction_proxy_lofi_helper.cc
|
| @@ -0,0 +1,32 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "components/data_reduction_proxy/content/browser/content_data_reduction_proxy_lofi_helper.h"
|
| +
|
| +#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h"
|
| +#include "content/public/browser/resource_request_info.h"
|
| +#include "net/url_request/url_request.h"
|
| +
|
| +namespace data_reduction_proxy {
|
| +
|
| +ContentDataReductionProxyLoFiHelper::ContentDataReductionProxyLoFiHelper() {}
|
| +
|
| +ContentDataReductionProxyLoFiHelper::~ContentDataReductionProxyLoFiHelper() {}
|
| +
|
| +bool ContentDataReductionProxyLoFiHelper::ShouldUseLoFi(
|
| + const net::URLRequest* request) const {
|
| + const content::ResourceRequestInfo* request_info =
|
| + content::ResourceRequestInfo::ForRequest(request);
|
| + if (request_info) {
|
| + // The Lo-Fi directive should not be added for users in the Lo-Fi field
|
| + // trial "Control" group unless he or she turns on Lo-Fi through a flag.
|
| + // Check that the user is in a group that should get "q=low".
|
| + return request_info->IsUsingLoFi() &&
|
| + (params::IsLoFiOnViaFlags() ||
|
| + params::IsIncludedInLoFiEnabledFieldTrial());
|
| + }
|
| + return false;
|
| +}
|
| +
|
| +} // namespace data_reduction_roxy
|
|
|