OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/proxy/proxy_config.h" | 5 #include "net/proxy/proxy_config.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/string_tokenizer.h" | |
9 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/strings/string_tokenizer.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "net/proxy/proxy_info.h" | 11 #include "net/proxy/proxy_info.h" |
12 | 12 |
13 namespace net { | 13 namespace net { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 // If |proxy| is valid, sets it in |dict| under the key |name|. | 17 // If |proxy| is valid, sets it in |dict| under the key |name|. |
18 void AddProxyToValue(const char* name, | 18 void AddProxyToValue(const char* name, |
19 const ProxyServer& proxy, | 19 const ProxyServer& proxy, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 void ProxyConfig::ProxyRules::ParseFromString(const std::string& proxy_rules) { | 73 void ProxyConfig::ProxyRules::ParseFromString(const std::string& proxy_rules) { |
74 // Reset. | 74 // Reset. |
75 type = TYPE_NO_RULES; | 75 type = TYPE_NO_RULES; |
76 single_proxy = ProxyServer(); | 76 single_proxy = ProxyServer(); |
77 proxy_for_http = ProxyServer(); | 77 proxy_for_http = ProxyServer(); |
78 proxy_for_https = ProxyServer(); | 78 proxy_for_https = ProxyServer(); |
79 proxy_for_ftp = ProxyServer(); | 79 proxy_for_ftp = ProxyServer(); |
80 fallback_proxy = ProxyServer(); | 80 fallback_proxy = ProxyServer(); |
81 | 81 |
82 StringTokenizer proxy_server_list(proxy_rules, ";"); | 82 base::StringTokenizer proxy_server_list(proxy_rules, ";"); |
83 while (proxy_server_list.GetNext()) { | 83 while (proxy_server_list.GetNext()) { |
84 StringTokenizer proxy_server_for_scheme( | 84 base::StringTokenizer proxy_server_for_scheme( |
85 proxy_server_list.token_begin(), proxy_server_list.token_end(), "="); | 85 proxy_server_list.token_begin(), proxy_server_list.token_end(), "="); |
86 | 86 |
87 while (proxy_server_for_scheme.GetNext()) { | 87 while (proxy_server_for_scheme.GetNext()) { |
88 std::string url_scheme = proxy_server_for_scheme.token(); | 88 std::string url_scheme = proxy_server_for_scheme.token(); |
89 | 89 |
90 // If we fail to get the proxy server here, it means that | 90 // If we fail to get the proxy server here, it means that |
91 // this is a regular proxy server configuration, i.e. proxies | 91 // this is a regular proxy server configuration, i.e. proxies |
92 // are not configured per protocol. | 92 // are not configured per protocol. |
93 if (!proxy_server_for_scheme.GetNext()) { | 93 if (!proxy_server_for_scheme.GetNext()) { |
94 if (type == TYPE_PROXY_PER_SCHEME) | 94 if (type == TYPE_PROXY_PER_SCHEME) |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 } | 252 } |
253 } | 253 } |
254 | 254 |
255 // Output the source. | 255 // Output the source. |
256 dict->SetString("source", ProxyConfigSourceToString(source_)); | 256 dict->SetString("source", ProxyConfigSourceToString(source_)); |
257 | 257 |
258 return dict; | 258 return dict; |
259 } | 259 } |
260 | 260 |
261 } // namespace net | 261 } // namespace net |
OLD | NEW |