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_service_win.h" | 5 #include "net/proxy/proxy_config_service_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <winhttp.h> | 8 #include <winhttp.h> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
14 #include "base/strings/string_tokenizer.h" | 14 #include "base/strings/string_tokenizer.h" |
| 15 #include "base/strings/utf_string_conversions.h" |
15 #include "base/threading/thread_restrictions.h" | 16 #include "base/threading/thread_restrictions.h" |
16 #include "base/win/registry.h" | 17 #include "base/win/registry.h" |
17 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
18 #include "net/proxy/proxy_config.h" | 19 #include "net/proxy/proxy_config.h" |
19 | 20 |
20 #pragma comment(lib, "winhttp.lib") | 21 #pragma comment(lib, "winhttp.lib") |
21 | 22 |
22 namespace net { | 23 namespace net { |
23 | 24 |
24 namespace { | 25 namespace { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 169 |
169 // static | 170 // static |
170 void ProxyConfigServiceWin::SetFromIEConfig( | 171 void ProxyConfigServiceWin::SetFromIEConfig( |
171 ProxyConfig* config, | 172 ProxyConfig* config, |
172 const WINHTTP_CURRENT_USER_IE_PROXY_CONFIG& ie_config) { | 173 const WINHTTP_CURRENT_USER_IE_PROXY_CONFIG& ie_config) { |
173 if (ie_config.fAutoDetect) | 174 if (ie_config.fAutoDetect) |
174 config->set_auto_detect(true); | 175 config->set_auto_detect(true); |
175 if (ie_config.lpszProxy) { | 176 if (ie_config.lpszProxy) { |
176 // lpszProxy may be a single proxy, or a proxy per scheme. The format | 177 // lpszProxy may be a single proxy, or a proxy per scheme. The format |
177 // is compatible with ProxyConfig::ProxyRules's string format. | 178 // is compatible with ProxyConfig::ProxyRules's string format. |
178 config->proxy_rules().ParseFromString(WideToASCII(ie_config.lpszProxy)); | 179 config->proxy_rules().ParseFromString( |
| 180 base::UTF16ToASCII(ie_config.lpszProxy)); |
179 } | 181 } |
180 if (ie_config.lpszProxyBypass) { | 182 if (ie_config.lpszProxyBypass) { |
181 std::string proxy_bypass = WideToASCII(ie_config.lpszProxyBypass); | 183 std::string proxy_bypass = base::UTF16ToASCII(ie_config.lpszProxyBypass); |
182 | 184 |
183 base::StringTokenizer proxy_server_bypass_list(proxy_bypass, ";, \t\n\r"); | 185 base::StringTokenizer proxy_server_bypass_list(proxy_bypass, ";, \t\n\r"); |
184 while (proxy_server_bypass_list.GetNext()) { | 186 while (proxy_server_bypass_list.GetNext()) { |
185 std::string bypass_url_domain = proxy_server_bypass_list.token(); | 187 std::string bypass_url_domain = proxy_server_bypass_list.token(); |
186 config->proxy_rules().bypass_rules.AddRuleFromString(bypass_url_domain); | 188 config->proxy_rules().bypass_rules.AddRuleFromString(bypass_url_domain); |
187 } | 189 } |
188 } | 190 } |
189 if (ie_config.lpszAutoConfigUrl) | 191 if (ie_config.lpszAutoConfigUrl) |
190 config->set_pac_url(GURL(ie_config.lpszAutoConfigUrl)); | 192 config->set_pac_url(GURL(ie_config.lpszAutoConfigUrl)); |
191 config->set_source(PROXY_CONFIG_SOURCE_SYSTEM); | 193 config->set_source(PROXY_CONFIG_SOURCE_SYSTEM); |
192 } | 194 } |
193 | 195 |
194 } // namespace net | 196 } // namespace net |
OLD | NEW |