OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/logging.h" | 11 #include "base/logging.h" |
11 #include "base/mac/foundation_util.h" | 12 #include "base/mac/foundation_util.h" |
12 #include "base/mac/scoped_cftyperef.h" | 13 #include "base/mac/scoped_cftyperef.h" |
13 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
14 #include "base/sys_string_conversions.h" | 15 #include "base/sys_string_conversions.h" |
15 #include "net/base/net_errors.h" | 16 #include "net/base/net_errors.h" |
16 #include "net/proxy/proxy_config.h" | 17 #include "net/proxy/proxy_config.h" |
17 #include "net/proxy/proxy_info.h" | 18 #include "net/proxy/proxy_info.h" |
18 #include "net/proxy/proxy_server.h" | 19 #include "net/proxy/proxy_server.h" |
19 | 20 |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 void ProxyConfigServiceMac::OnNetworkConfigChange(CFArrayRef changed_keys) { | 242 void ProxyConfigServiceMac::OnNetworkConfigChange(CFArrayRef changed_keys) { |
242 // Called on notifier thread. | 243 // Called on notifier thread. |
243 | 244 |
244 // Fetch the new system proxy configuration. | 245 // Fetch the new system proxy configuration. |
245 ProxyConfig new_config; | 246 ProxyConfig new_config; |
246 GetCurrentProxyConfig(&new_config); | 247 GetCurrentProxyConfig(&new_config); |
247 | 248 |
248 // Call OnProxyConfigChanged() on the IO thread to notify our observers. | 249 // Call OnProxyConfigChanged() on the IO thread to notify our observers. |
249 io_loop_->PostTask( | 250 io_loop_->PostTask( |
250 FROM_HERE, | 251 FROM_HERE, |
251 NewRunnableMethod( | 252 base::Bind(&Helper::OnProxyConfigChanged, helper_.get(), new_config)); |
252 helper_.get(), &Helper::OnProxyConfigChanged, new_config)); | |
253 } | 253 } |
254 | 254 |
255 void ProxyConfigServiceMac::OnProxyConfigChanged( | 255 void ProxyConfigServiceMac::OnProxyConfigChanged( |
256 const ProxyConfig& new_config) { | 256 const ProxyConfig& new_config) { |
257 DCHECK_EQ(io_loop_, MessageLoop::current()); | 257 DCHECK_EQ(io_loop_, MessageLoop::current()); |
258 | 258 |
259 // Keep track of the last value we have seen. | 259 // Keep track of the last value we have seen. |
260 has_fetched_config_ = true; | 260 has_fetched_config_ = true; |
261 last_config_fetched_ = new_config; | 261 last_config_fetched_ = new_config; |
262 | 262 |
263 // Notify all the observers. | 263 // Notify all the observers. |
264 FOR_EACH_OBSERVER(Observer, observers_, | 264 FOR_EACH_OBSERVER(Observer, observers_, |
265 OnProxyConfigChanged(new_config, CONFIG_VALID)); | 265 OnProxyConfigChanged(new_config, CONFIG_VALID)); |
266 } | 266 } |
267 | 267 |
268 } // namespace net | 268 } // namespace net |
OLD | NEW |