| OLD | NEW |
| 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 GetBoolFromDictionary(config_dict.get(), | 236 GetBoolFromDictionary(config_dict.get(), |
| 237 kSCPropNetProxiesExcludeSimpleHostnames, | 237 kSCPropNetProxiesExcludeSimpleHostnames, |
| 238 false); | 238 false); |
| 239 | 239 |
| 240 return OK; | 240 return OK; |
| 241 } | 241 } |
| 242 | 242 |
| 243 // Gets the proxy information for a query URL from a PAC. Implementation | 243 // Gets the proxy information for a query URL from a PAC. Implementation |
| 244 // inspired by http://developer.apple.com/samplecode/CFProxySupportTool/ | 244 // inspired by http://developer.apple.com/samplecode/CFProxySupportTool/ |
| 245 int ProxyResolverMac::GetProxyForURL(const GURL& query_url, | 245 int ProxyResolverMac::GetProxyForURL(const GURL& query_url, |
| 246 const GURL& pac_url, | 246 ProxyInfo* results, |
| 247 ProxyInfo* results) { | 247 CompletionCallback* /*callback*/, |
| 248 RequestHandle* /*request*/) { |
| 248 scoped_cftyperef<CFStringRef> query_ref( | 249 scoped_cftyperef<CFStringRef> query_ref( |
| 249 base::SysUTF8ToCFStringRef(query_url.spec())); | 250 base::SysUTF8ToCFStringRef(query_url.spec())); |
| 250 scoped_cftyperef<CFURLRef> query_url_ref( | 251 scoped_cftyperef<CFURLRef> query_url_ref( |
| 251 CFURLCreateWithString(kCFAllocatorDefault, | 252 CFURLCreateWithString(kCFAllocatorDefault, |
| 252 query_ref.get(), | 253 query_ref.get(), |
| 253 NULL)); | 254 NULL)); |
| 254 if (!query_url_ref.get()) | 255 if (!query_url_ref.get()) |
| 255 return ERR_FAILED; | 256 return ERR_FAILED; |
| 256 scoped_cftyperef<CFStringRef> pac_ref( | 257 scoped_cftyperef<CFStringRef> pac_ref( |
| 257 base::SysUTF8ToCFStringRef(pac_url.spec())); | 258 base::SysUTF8ToCFStringRef(pac_url_.spec())); |
| 258 scoped_cftyperef<CFURLRef> pac_url_ref( | 259 scoped_cftyperef<CFURLRef> pac_url_ref( |
| 259 CFURLCreateWithString(kCFAllocatorDefault, | 260 CFURLCreateWithString(kCFAllocatorDefault, |
| 260 pac_ref.get(), | 261 pac_ref.get(), |
| 261 NULL)); | 262 NULL)); |
| 262 if (!pac_url_ref.get()) | 263 if (!pac_url_ref.get()) |
| 263 return ERR_FAILED; | 264 return ERR_FAILED; |
| 264 | 265 |
| 265 // Work around <rdar://problem/5530166>. This dummy call to | 266 // Work around <rdar://problem/5530166>. This dummy call to |
| 266 // CFNetworkCopyProxiesForURL initializes some state within CFNetwork that is | 267 // CFNetworkCopyProxiesForURL initializes some state within CFNetwork that is |
| 267 // required by CFNetworkExecuteProxyAutoConfigurationURL. | 268 // required by CFNetworkExecuteProxyAutoConfigurationURL. |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 } | 349 } |
| 349 | 350 |
| 350 if (!proxy_uri_list.empty()) | 351 if (!proxy_uri_list.empty()) |
| 351 results->UseNamedProxy(proxy_uri_list); | 352 results->UseNamedProxy(proxy_uri_list); |
| 352 // Else do nothing (results is already guaranteed to be in the default state). | 353 // Else do nothing (results is already guaranteed to be in the default state). |
| 353 | 354 |
| 354 return OK; | 355 return OK; |
| 355 } | 356 } |
| 356 | 357 |
| 357 } // namespace net | 358 } // namespace net |
| OLD | NEW |