| 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_mac.h" | 5 #include "net/proxy/proxy_config_service_mac.h" |
| 6 | 6 |
| 7 #include <CoreFoundation/CoreFoundation.h> | 7 #include <CoreFoundation/CoreFoundation.h> |
| 8 #include <SystemConfiguration/SystemConfiguration.h> | 8 #include <SystemConfiguration/SystemConfiguration.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 return default_value; | 35 return default_value; |
| 36 | 36 |
| 37 int int_value; | 37 int int_value; |
| 38 if (CFNumberGetValue(number, kCFNumberIntType, &int_value)) | 38 if (CFNumberGetValue(number, kCFNumberIntType, &int_value)) |
| 39 return int_value; | 39 return int_value; |
| 40 else | 40 else |
| 41 return default_value; | 41 return default_value; |
| 42 } | 42 } |
| 43 | 43 |
| 44 void GetCurrentProxyConfig(ProxyConfig* config) { | 44 void GetCurrentProxyConfig(ProxyConfig* config) { |
| 45 base::mac::ScopedCFTypeRef<CFDictionaryRef> config_dict( | 45 base::ScopedCFTypeRef<CFDictionaryRef> config_dict( |
| 46 SCDynamicStoreCopyProxies(NULL)); | 46 SCDynamicStoreCopyProxies(NULL)); |
| 47 DCHECK(config_dict); | 47 DCHECK(config_dict); |
| 48 | 48 |
| 49 // auto-detect | 49 // auto-detect |
| 50 | 50 |
| 51 // There appears to be no UI for this configuration option, and we're not sure | 51 // There appears to be no UI for this configuration option, and we're not sure |
| 52 // if Apple's proxy code even takes it into account. But the constant is in | 52 // if Apple's proxy code even takes it into account. But the constant is in |
| 53 // the header file so we'll use it. | 53 // the header file so we'll use it. |
| 54 config->set_auto_detect( | 54 config->set_auto_detect( |
| 55 GetBoolFromDictionary(config_dict.get(), | 55 GetBoolFromDictionary(config_dict.get(), |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 // Keep track of the last value we have seen. | 277 // Keep track of the last value we have seen. |
| 278 has_fetched_config_ = true; | 278 has_fetched_config_ = true; |
| 279 last_config_fetched_ = new_config; | 279 last_config_fetched_ = new_config; |
| 280 | 280 |
| 281 // Notify all the observers. | 281 // Notify all the observers. |
| 282 FOR_EACH_OBSERVER(Observer, observers_, | 282 FOR_EACH_OBSERVER(Observer, observers_, |
| 283 OnProxyConfigChanged(new_config, CONFIG_VALID)); | 283 OnProxyConfigChanged(new_config, CONFIG_VALID)); |
| 284 } | 284 } |
| 285 | 285 |
| 286 } // namespace net | 286 } // namespace net |
| OLD | NEW |