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

Side by Side Diff: components/data_reduction_proxy/core/common/data_reduction_proxy_headers.cc

Issue 2887423002: Add an about:flag to support alternative data saver features (Closed)
Patch Set: tbansal nits Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_heade rs.h" 5 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_heade rs.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 28 matching lines...) Expand all
39 39
40 // Previews directives. 40 // Previews directives.
41 const char kEmptyImageDirective[] = "empty-image"; 41 const char kEmptyImageDirective[] = "empty-image";
42 const char kLitePageDirective[] = "lite-page"; 42 const char kLitePageDirective[] = "lite-page";
43 const char kCompressedVideoDirective[] = "compressed-video"; 43 const char kCompressedVideoDirective[] = "compressed-video";
44 const char kIdentityDirective[] = "identity"; 44 const char kIdentityDirective[] = "identity";
45 45
46 // The legacy Chrome-Proxy response header directive for LoFi images. 46 // The legacy Chrome-Proxy response header directive for LoFi images.
47 const char kLegacyChromeProxyLoFiResponseDirective[] = "q=low"; 47 const char kLegacyChromeProxyLoFiResponseDirective[] = "q=low";
48 48
49 const char kChromeProxyLitePageIngoreBlacklistDirective[] = 49 const char kChromeProxyLitePageIngoreBlacklist[] = "ignore_preview_blacklist";
50 "exp=ignore_preview_blacklist";
51 50
52 const char kIfHeavyQualifier[] = "if-heavy"; 51 const char kIfHeavyQualifier[] = "if-heavy";
53 52
54 const char kChromeProxyActionBlockOnce[] = "block-once"; 53 const char kChromeProxyActionBlockOnce[] = "block-once";
55 const char kChromeProxyActionBlock[] = "block"; 54 const char kChromeProxyActionBlock[] = "block";
56 const char kChromeProxyActionBypass[] = "bypass"; 55 const char kChromeProxyActionBypass[] = "bypass";
57 56
58 // Actions for tamper detection fingerprints. 57 // Actions for tamper detection fingerprints.
59 const char kChromeProxyActionFingerprintChromeProxy[] = "fcp"; 58 const char kChromeProxyActionFingerprintChromeProxy[] = "fcp";
60 const char kChromeProxyActionFingerprintVia[] = "fvia"; 59 const char kChromeProxyActionFingerprintVia[] = "fvia";
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 } 147 }
149 148
150 const char* compressed_video_directive() { 149 const char* compressed_video_directive() {
151 return kCompressedVideoDirective; 150 return kCompressedVideoDirective;
152 } 151 }
153 152
154 const char* identity_directive() { 153 const char* identity_directive() {
155 return kIdentityDirective; 154 return kIdentityDirective;
156 } 155 }
157 156
158 const char* chrome_proxy_lite_page_ignore_blacklist_directive() { 157 const char* chrome_proxy_lite_page_ignore_blacklist() {
159 return kChromeProxyLitePageIngoreBlacklistDirective; 158 return kChromeProxyLitePageIngoreBlacklist;
160 } 159 }
161 160
162 const char* if_heavy_qualifier() { 161 const char* if_heavy_qualifier() {
163 return kIfHeavyQualifier; 162 return kIfHeavyQualifier;
164 } 163 }
165 164
166 bool IsEmptyImagePreview(const net::HttpResponseHeaders& headers) { 165 bool IsEmptyImagePreview(const net::HttpResponseHeaders& headers) {
167 return IsPreviewType(headers, kEmptyImageDirective) || 166 return IsPreviewType(headers, kEmptyImageDirective) ||
168 headers.HasHeaderValue(kChromeProxyHeader, 167 headers.HasHeaderValue(kChromeProxyHeader,
169 kLegacyChromeProxyLoFiResponseDirective); 168 kLegacyChromeProxyLoFiResponseDirective);
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 std::string value; 428 std::string value;
430 size_t iter = 0; 429 size_t iter = 0;
431 while (headers->EnumerateHeader(&iter, kChromeProxyHeader, &value)) { 430 while (headers->EnumerateHeader(&iter, kChromeProxyHeader, &value)) {
432 if (StartsWithActionPrefix(value, kChromeProxyActionFingerprintChromeProxy)) 431 if (StartsWithActionPrefix(value, kChromeProxyActionFingerprintChromeProxy))
433 continue; 432 continue;
434 values->push_back(std::move(value)); 433 values->push_back(std::move(value));
435 } 434 }
436 } 435 }
437 436
438 } // namespace data_reduction_proxy 437 } // namespace data_reduction_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698