OLD | NEW |
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 Loading... |
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 kChromeProxyForceLitePageDirective[] = "exp=force_lite_page"; |
50 "exp=ignore_preview_blacklist"; | |
51 | |
52 const char kIfHeavyQualifier[] = "if-heavy"; | |
53 | 50 |
54 const char kChromeProxyActionBlockOnce[] = "block-once"; | 51 const char kChromeProxyActionBlockOnce[] = "block-once"; |
55 const char kChromeProxyActionBlock[] = "block"; | 52 const char kChromeProxyActionBlock[] = "block"; |
56 const char kChromeProxyActionBypass[] = "bypass"; | 53 const char kChromeProxyActionBypass[] = "bypass"; |
57 | 54 |
58 // Actions for tamper detection fingerprints. | 55 // Actions for tamper detection fingerprints. |
59 const char kChromeProxyActionFingerprintChromeProxy[] = "fcp"; | 56 const char kChromeProxyActionFingerprintChromeProxy[] = "fcp"; |
60 const char kChromeProxyActionFingerprintVia[] = "fvia"; | 57 const char kChromeProxyActionFingerprintVia[] = "fvia"; |
61 const char kChromeProxyActionFingerprintOtherHeaders[] = "foh"; | 58 const char kChromeProxyActionFingerprintOtherHeaders[] = "foh"; |
62 const char kChromeProxyActionFingerprintContentLength[] = "fcl"; | 59 const char kChromeProxyActionFingerprintContentLength[] = "fcl"; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 } | 145 } |
149 | 146 |
150 const char* compressed_video_directive() { | 147 const char* compressed_video_directive() { |
151 return kCompressedVideoDirective; | 148 return kCompressedVideoDirective; |
152 } | 149 } |
153 | 150 |
154 const char* identity_directive() { | 151 const char* identity_directive() { |
155 return kIdentityDirective; | 152 return kIdentityDirective; |
156 } | 153 } |
157 | 154 |
158 const char* chrome_proxy_lite_page_ignore_blacklist_directive() { | 155 const char* chrome_proxy_force_lite_page_directive() { |
159 return kChromeProxyLitePageIngoreBlacklistDirective; | 156 return kChromeProxyForceLitePageDirective; |
160 } | |
161 | |
162 const char* if_heavy_qualifier() { | |
163 return kIfHeavyQualifier; | |
164 } | 157 } |
165 | 158 |
166 bool IsEmptyImagePreview(const net::HttpResponseHeaders& headers) { | 159 bool IsEmptyImagePreview(const net::HttpResponseHeaders& headers) { |
167 return IsPreviewType(headers, kEmptyImageDirective) || | 160 return IsPreviewType(headers, kEmptyImageDirective) || |
168 headers.HasHeaderValue(kChromeProxyHeader, | 161 headers.HasHeaderValue(kChromeProxyHeader, |
169 kLegacyChromeProxyLoFiResponseDirective); | 162 kLegacyChromeProxyLoFiResponseDirective); |
170 } | 163 } |
171 | 164 |
172 bool IsEmptyImagePreview(const std::string& content_transform_value, | 165 bool IsEmptyImagePreview(const std::string& content_transform_value, |
173 const std::string& chrome_proxy_value) { | 166 const std::string& chrome_proxy_value) { |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 std::string value; | 422 std::string value; |
430 size_t iter = 0; | 423 size_t iter = 0; |
431 while (headers->EnumerateHeader(&iter, kChromeProxyHeader, &value)) { | 424 while (headers->EnumerateHeader(&iter, kChromeProxyHeader, &value)) { |
432 if (StartsWithActionPrefix(value, kChromeProxyActionFingerprintChromeProxy)) | 425 if (StartsWithActionPrefix(value, kChromeProxyActionFingerprintChromeProxy)) |
433 continue; | 426 continue; |
434 values->push_back(std::move(value)); | 427 values->push_back(std::move(value)); |
435 } | 428 } |
436 } | 429 } |
437 | 430 |
438 } // namespace data_reduction_proxy | 431 } // namespace data_reduction_proxy |
OLD | NEW |