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 12 matching lines...) Expand all Loading... |
23 using base::StringPiece; | 23 using base::StringPiece; |
24 using base::TimeDelta; | 24 using base::TimeDelta; |
25 | 25 |
26 namespace { | 26 namespace { |
27 | 27 |
28 const char kChromeProxyHeader[] = "chrome-proxy"; | 28 const char kChromeProxyHeader[] = "chrome-proxy"; |
29 | 29 |
30 const char kActionValueDelimiter = '='; | 30 const char kActionValueDelimiter = '='; |
31 | 31 |
32 const char kChromeProxyLoFiDirective[] = "q=low"; | 32 const char kChromeProxyLoFiDirective[] = "q=low"; |
33 const char kChromeProxyLoFiPreviewDirective[] = "q=preview"; | 33 const char kChromeProxyLitePageDirective[] = "q=preview"; |
34 const char kChromeProxyLoFiIngorePreviewBlacklistDirective[] = | 34 const char kChromeProxyLitePageIngoreBlacklistDirective[] = |
35 "exp=ignore_preview_blacklist"; | 35 "exp=ignore_preview_blacklist"; |
36 | 36 |
37 const char kChromeProxyActionBlockOnce[] = "block-once"; | 37 const char kChromeProxyActionBlockOnce[] = "block-once"; |
38 const char kChromeProxyActionBlock[] = "block"; | 38 const char kChromeProxyActionBlock[] = "block"; |
39 const char kChromeProxyActionBypass[] = "bypass"; | 39 const char kChromeProxyActionBypass[] = "bypass"; |
40 | 40 |
41 // Actions for tamper detection fingerprints. | 41 // Actions for tamper detection fingerprints. |
42 const char kChromeProxyActionFingerprintChromeProxy[] = "fcp"; | 42 const char kChromeProxyActionFingerprintChromeProxy[] = "fcp"; |
43 const char kChromeProxyActionFingerprintVia[] = "fvia"; | 43 const char kChromeProxyActionFingerprintVia[] = "fvia"; |
44 const char kChromeProxyActionFingerprintOtherHeaders[] = "foh"; | 44 const char kChromeProxyActionFingerprintOtherHeaders[] = "foh"; |
(...skipping 27 matching lines...) Expand all Loading... |
72 namespace data_reduction_proxy { | 72 namespace data_reduction_proxy { |
73 | 73 |
74 const char* chrome_proxy_header() { | 74 const char* chrome_proxy_header() { |
75 return kChromeProxyHeader; | 75 return kChromeProxyHeader; |
76 } | 76 } |
77 | 77 |
78 const char* chrome_proxy_lo_fi_directive() { | 78 const char* chrome_proxy_lo_fi_directive() { |
79 return kChromeProxyLoFiDirective; | 79 return kChromeProxyLoFiDirective; |
80 } | 80 } |
81 | 81 |
82 const char* chrome_proxy_lo_fi_preview_directive() { | 82 const char* chrome_proxy_lite_page_directive() { |
83 return kChromeProxyLoFiPreviewDirective; | 83 return kChromeProxyLitePageDirective; |
84 } | 84 } |
85 | 85 |
86 const char* chrome_proxy_lo_fi_ignore_preview_blacklist_directive() { | 86 const char* chrome_proxy_lite_page_ignore_blacklist_directive() { |
87 return kChromeProxyLoFiIngorePreviewBlacklistDirective; | 87 return kChromeProxyLitePageIngoreBlacklistDirective; |
88 } | 88 } |
89 | 89 |
90 bool GetDataReductionProxyActionValue(const net::HttpResponseHeaders* headers, | 90 bool GetDataReductionProxyActionValue(const net::HttpResponseHeaders* headers, |
91 base::StringPiece action_prefix, | 91 base::StringPiece action_prefix, |
92 std::string* action_value) { | 92 std::string* action_value) { |
93 DCHECK(headers); | 93 DCHECK(headers); |
94 size_t iter = 0; | 94 size_t iter = 0; |
95 std::string value; | 95 std::string value; |
96 | 96 |
97 while (headers->EnumerateHeader(&iter, kChromeProxyHeader, &value)) { | 97 while (headers->EnumerateHeader(&iter, kChromeProxyHeader, &value)) { |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 std::string value; | 316 std::string value; |
317 size_t iter = 0; | 317 size_t iter = 0; |
318 while (headers->EnumerateHeader(&iter, kChromeProxyHeader, &value)) { | 318 while (headers->EnumerateHeader(&iter, kChromeProxyHeader, &value)) { |
319 if (StartsWithActionPrefix(value, kChromeProxyActionFingerprintChromeProxy)) | 319 if (StartsWithActionPrefix(value, kChromeProxyActionFingerprintChromeProxy)) |
320 continue; | 320 continue; |
321 values->push_back(std::move(value)); | 321 values->push_back(std::move(value)); |
322 } | 322 } |
323 } | 323 } |
324 | 324 |
325 } // namespace data_reduction_proxy | 325 } // namespace data_reduction_proxy |
OLD | NEW |