Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(436)

Side by Side Diff: net/proxy/proxy_resolver_mac.cc

Issue 383010: Grab SOCKS settings from system prefs.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2008 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_resolver_mac.h" 5 #include "net/proxy/proxy_resolver_mac.h"
6 6
7 #include <CoreFoundation/CoreFoundation.h> 7 #include <CoreFoundation/CoreFoundation.h>
8 #include <CoreServices/CoreServices.h> 8 #include <CoreServices/CoreServices.h>
9 #include <SystemConfiguration/SystemConfiguration.h> 9 #include <SystemConfiguration/SystemConfiguration.h>
10 10
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 false)) { 158 false)) {
159 CFStringRef pac_url_ref = 159 CFStringRef pac_url_ref =
160 (CFStringRef)GetValueFromDictionary( 160 (CFStringRef)GetValueFromDictionary(
161 config_dict.get(), 161 config_dict.get(),
162 kSCPropNetProxiesProxyAutoConfigURLString, 162 kSCPropNetProxiesProxyAutoConfigURLString,
163 CFStringGetTypeID()); 163 CFStringGetTypeID());
164 if (pac_url_ref) 164 if (pac_url_ref)
165 config->pac_url = GURL(base::SysCFStringRefToUTF8(pac_url_ref)); 165 config->pac_url = GURL(base::SysCFStringRefToUTF8(pac_url_ref));
166 } 166 }
167 167
168 // proxies (for now only ftp, http and https) 168 // proxies (for now ftp, http, https, and SOCKS)
169 169
170 if (GetBoolFromDictionary(config_dict.get(), 170 if (GetBoolFromDictionary(config_dict.get(),
171 kSCPropNetProxiesFTPEnable, 171 kSCPropNetProxiesFTPEnable,
172 false)) { 172 false)) {
173 ProxyServer proxy_server = 173 ProxyServer proxy_server =
174 GetProxyServerFromDictionary(ProxyServer::SCHEME_HTTP, 174 GetProxyServerFromDictionary(ProxyServer::SCHEME_HTTP,
175 config_dict.get(), 175 config_dict.get(),
176 kSCPropNetProxiesFTPProxy, 176 kSCPropNetProxiesFTPProxy,
177 kSCPropNetProxiesFTPPort); 177 kSCPropNetProxiesFTPPort);
178 if (proxy_server.is_valid()) { 178 if (proxy_server.is_valid()) {
(...skipping 20 matching lines...) Expand all
199 ProxyServer proxy_server = 199 ProxyServer proxy_server =
200 GetProxyServerFromDictionary(ProxyServer::SCHEME_HTTP, 200 GetProxyServerFromDictionary(ProxyServer::SCHEME_HTTP,
201 config_dict.get(), 201 config_dict.get(),
202 kSCPropNetProxiesHTTPSProxy, 202 kSCPropNetProxiesHTTPSProxy,
203 kSCPropNetProxiesHTTPSPort); 203 kSCPropNetProxiesHTTPSPort);
204 if (proxy_server.is_valid()) { 204 if (proxy_server.is_valid()) {
205 config->proxy_rules.type = ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME; 205 config->proxy_rules.type = ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME;
206 config->proxy_rules.proxy_for_https = proxy_server; 206 config->proxy_rules.proxy_for_https = proxy_server;
207 } 207 }
208 } 208 }
209 if (GetBoolFromDictionary(config_dict.get(),
210 kSCPropNetProxiesSOCKSEnable,
211 false)) {
212 ProxyServer proxy_server =
213 GetProxyServerFromDictionary(ProxyServer::SCHEME_SOCKS5,
214 config_dict.get(),
215 kSCPropNetProxiesSOCKSProxy,
216 kSCPropNetProxiesSOCKSPort);
217 if (proxy_server.is_valid()) {
218 config->proxy_rules.type = ProxyConfig::ProxyRules::TYPE_PROXY_PER_SCHEME;
219 config->proxy_rules.socks_proxy = proxy_server;
220 }
221 }
209 222
210 // proxy bypass list 223 // proxy bypass list
211 224
212 CFArrayRef bypass_array_ref = 225 CFArrayRef bypass_array_ref =
213 (CFArrayRef)GetValueFromDictionary(config_dict.get(), 226 (CFArrayRef)GetValueFromDictionary(config_dict.get(),
214 kSCPropNetProxiesExceptionsList, 227 kSCPropNetProxiesExceptionsList,
215 CFArrayGetTypeID()); 228 CFArrayGetTypeID());
216 if (bypass_array_ref) { 229 if (bypass_array_ref) {
217 CFIndex bypass_array_count = CFArrayGetCount(bypass_array_ref); 230 CFIndex bypass_array_count = CFArrayGetCount(bypass_array_ref);
218 for (CFIndex i = 0; i < bypass_array_count; ++i) { 231 for (CFIndex i = 0; i < bypass_array_count; ++i) {
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 } 363 }
351 364
352 if (!proxy_uri_list.empty()) 365 if (!proxy_uri_list.empty())
353 results->UseNamedProxy(proxy_uri_list); 366 results->UseNamedProxy(proxy_uri_list);
354 // Else do nothing (results is already guaranteed to be in the default state). 367 // Else do nothing (results is already guaranteed to be in the default state).
355 368
356 return OK; 369 return OK;
357 } 370 }
358 371
359 } // namespace net 372 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698