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 "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" | 5 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 proxy_rules.proxies_for_https); | 60 proxy_rules.proxies_for_https); |
61 } | 61 } |
62 | 62 |
63 // Extract the embedded PAC script from the given |pac_url|, and store the | 63 // Extract the embedded PAC script from the given |pac_url|, and store the |
64 // extracted script in |pac_script|. Returns true if extraction was successful, | 64 // extracted script in |pac_script|. Returns true if extraction was successful, |
65 // otherwise returns false. |pac_script| must not be NULL. | 65 // otherwise returns false. |pac_script| must not be NULL. |
66 bool GetEmbeddedPacScript(const std::string& pac_url, std::string* pac_script) { | 66 bool GetEmbeddedPacScript(const std::string& pac_url, std::string* pac_script) { |
67 DCHECK(pac_script); | 67 DCHECK(pac_script); |
68 const std::string kPacURLPrefix = | 68 const std::string kPacURLPrefix = |
69 "data:application/x-ns-proxy-autoconfig;base64,"; | 69 "data:application/x-ns-proxy-autoconfig;base64,"; |
70 return base::StartsWithASCII(pac_url, kPacURLPrefix, true) && | 70 return base::StartsWith(pac_url, kPacURLPrefix, |
| 71 base::CompareCase::SENSITIVE) && |
71 base::Base64Decode(pac_url.substr(kPacURLPrefix.size()), pac_script); | 72 base::Base64Decode(pac_url.substr(kPacURLPrefix.size()), pac_script); |
72 } | 73 } |
73 | 74 |
74 } // namespace | 75 } // namespace |
75 | 76 |
76 // The Data Reduction Proxy has been turned into a "best effort" proxy, | 77 // The Data Reduction Proxy has been turned into a "best effort" proxy, |
77 // meaning it is used only if the effective proxy configuration resolves to | 78 // meaning it is used only if the effective proxy configuration resolves to |
78 // DIRECT for a URL. It no longer can be a ProxyConfig in the proxy preference | 79 // DIRECT for a URL. It no longer can be a ProxyConfig in the proxy preference |
79 // hierarchy. This method removes the Data Reduction Proxy configuration from | 80 // hierarchy. This method removes the Data Reduction Proxy configuration from |
80 // prefs, if present. |proxy_pref_name| is the name of the proxy pref. | 81 // prefs, if present. |proxy_pref_name| is the name of the proxy pref. |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 #elif defined(OS_OPENBSD) | 228 #elif defined(OS_OPENBSD) |
228 return data_reduction_proxy::Client::CHROME_OPENBSD; | 229 return data_reduction_proxy::Client::CHROME_OPENBSD; |
229 #elif defined(OS_SOLARIS) | 230 #elif defined(OS_SOLARIS) |
230 return data_reduction_proxy::Client::CHROME_SOLARIS; | 231 return data_reduction_proxy::Client::CHROME_SOLARIS; |
231 #elif defined(OS_QNX) | 232 #elif defined(OS_QNX) |
232 return data_reduction_proxy::Client::CHROME_QNX; | 233 return data_reduction_proxy::Client::CHROME_QNX; |
233 #else | 234 #else |
234 return data_reduction_proxy::Client::UNKNOWN; | 235 return data_reduction_proxy::Client::UNKNOWN; |
235 #endif | 236 #endif |
236 } | 237 } |
OLD | NEW |