| 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/bind.h" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 void Orphan() { | 172 void Orphan() { |
| 173 parent_ = NULL; | 173 parent_ = NULL; |
| 174 } | 174 } |
| 175 | 175 |
| 176 void OnProxyConfigChanged(const ProxyConfig& new_config) { | 176 void OnProxyConfigChanged(const ProxyConfig& new_config) { |
| 177 if (parent_) | 177 if (parent_) |
| 178 parent_->OnProxyConfigChanged(new_config); | 178 parent_->OnProxyConfigChanged(new_config); |
| 179 } | 179 } |
| 180 | 180 |
| 181 private: | 181 private: |
| 182 friend class base::RefCountedThreadSafe<Helper>; |
| 183 |
| 184 ~Helper() {} |
| 185 |
| 182 ProxyConfigServiceMac* parent_; | 186 ProxyConfigServiceMac* parent_; |
| 183 }; | 187 }; |
| 184 | 188 |
| 185 ProxyConfigServiceMac::ProxyConfigServiceMac(MessageLoop* io_loop) | 189 ProxyConfigServiceMac::ProxyConfigServiceMac(MessageLoop* io_loop) |
| 186 : forwarder_(this), | 190 : forwarder_(this), |
| 187 has_fetched_config_(false), | 191 has_fetched_config_(false), |
| 188 helper_(new Helper(this)), | 192 helper_(new Helper(this)), |
| 189 io_loop_(io_loop) { | 193 io_loop_(io_loop) { |
| 190 DCHECK(io_loop); | 194 DCHECK(io_loop); |
| 191 config_watcher_.reset(new NetworkConfigWatcherMac(&forwarder_)); | 195 config_watcher_.reset(new NetworkConfigWatcherMac(&forwarder_)); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 // Keep track of the last value we have seen. | 263 // Keep track of the last value we have seen. |
| 260 has_fetched_config_ = true; | 264 has_fetched_config_ = true; |
| 261 last_config_fetched_ = new_config; | 265 last_config_fetched_ = new_config; |
| 262 | 266 |
| 263 // Notify all the observers. | 267 // Notify all the observers. |
| 264 FOR_EACH_OBSERVER(Observer, observers_, | 268 FOR_EACH_OBSERVER(Observer, observers_, |
| 265 OnProxyConfigChanged(new_config, CONFIG_VALID)); | 269 OnProxyConfigChanged(new_config, CONFIG_VALID)); |
| 266 } | 270 } |
| 267 | 271 |
| 268 } // namespace net | 272 } // namespace net |
| OLD | NEW |