OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/logging.h" | 10 #include "base/logging.h" |
11 #include "base/mac_util.h" | 11 #include "base/mac_util.h" |
12 #include "base/scoped_cftyperef.h" | 12 #include "base/mac/scoped_cftyperef.h" |
13 #include "base/sys_string_conversions.h" | 13 #include "base/sys_string_conversions.h" |
14 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
15 #include "net/proxy/proxy_config.h" | 15 #include "net/proxy/proxy_config.h" |
16 #include "net/proxy/proxy_info.h" | 16 #include "net/proxy/proxy_info.h" |
17 #include "net/proxy/proxy_server.h" | 17 #include "net/proxy/proxy_server.h" |
18 | 18 |
19 namespace net { | 19 namespace net { |
20 | 20 |
21 namespace { | 21 namespace { |
22 | 22 |
(...skipping 10 matching lines...) Expand all Loading... |
33 return default_value; | 33 return default_value; |
34 | 34 |
35 int int_value; | 35 int int_value; |
36 if (CFNumberGetValue(number, kCFNumberIntType, &int_value)) | 36 if (CFNumberGetValue(number, kCFNumberIntType, &int_value)) |
37 return int_value; | 37 return int_value; |
38 else | 38 else |
39 return default_value; | 39 return default_value; |
40 } | 40 } |
41 | 41 |
42 void GetCurrentProxyConfig(ProxyConfig* config) { | 42 void GetCurrentProxyConfig(ProxyConfig* config) { |
43 scoped_cftyperef<CFDictionaryRef> config_dict( | 43 base::mac::ScopedCFTypeRef<CFDictionaryRef> config_dict( |
44 SCDynamicStoreCopyProxies(NULL)); | 44 SCDynamicStoreCopyProxies(NULL)); |
45 DCHECK(config_dict); | 45 DCHECK(config_dict); |
46 | 46 |
47 // auto-detect | 47 // auto-detect |
48 | 48 |
49 // There appears to be no UI for this configuration option, and we're not sure | 49 // There appears to be no UI for this configuration option, and we're not sure |
50 // if Apple's proxy code even takes it into account. But the constant is in | 50 // if Apple's proxy code even takes it into account. But the constant is in |
51 // the header file so we'll use it. | 51 // the header file so we'll use it. |
52 config->set_auto_detect( | 52 config->set_auto_detect( |
53 GetBoolFromDictionary(config_dict.get(), | 53 GetBoolFromDictionary(config_dict.get(), |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 | 259 |
260 // Keep track of the last value we have seen. | 260 // Keep track of the last value we have seen. |
261 has_fetched_config_ = true; | 261 has_fetched_config_ = true; |
262 last_config_fetched_ = new_config; | 262 last_config_fetched_ = new_config; |
263 | 263 |
264 // Notify all the observers. | 264 // Notify all the observers. |
265 FOR_EACH_OBSERVER(Observer, observers_, OnProxyConfigChanged(new_config)); | 265 FOR_EACH_OBSERVER(Observer, observers_, OnProxyConfigChanged(new_config)); |
266 } | 266 } |
267 | 267 |
268 } // namespace net | 268 } // namespace net |
OLD | NEW |