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 ~Helper() {} |
| 184 |
182 ProxyConfigServiceMac* parent_; | 185 ProxyConfigServiceMac* parent_; |
183 }; | 186 }; |
184 | 187 |
185 ProxyConfigServiceMac::ProxyConfigServiceMac(MessageLoop* io_loop) | 188 ProxyConfigServiceMac::ProxyConfigServiceMac(MessageLoop* io_loop) |
186 : forwarder_(this), | 189 : forwarder_(this), |
187 has_fetched_config_(false), | 190 has_fetched_config_(false), |
188 helper_(new Helper(this)), | 191 helper_(new Helper(this)), |
189 io_loop_(io_loop) { | 192 io_loop_(io_loop) { |
190 DCHECK(io_loop); | 193 DCHECK(io_loop); |
191 config_watcher_.reset(new NetworkConfigWatcherMac(&forwarder_)); | 194 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. | 262 // Keep track of the last value we have seen. |
260 has_fetched_config_ = true; | 263 has_fetched_config_ = true; |
261 last_config_fetched_ = new_config; | 264 last_config_fetched_ = new_config; |
262 | 265 |
263 // Notify all the observers. | 266 // Notify all the observers. |
264 FOR_EACH_OBSERVER(Observer, observers_, | 267 FOR_EACH_OBSERVER(Observer, observers_, |
265 OnProxyConfigChanged(new_config, CONFIG_VALID)); | 268 OnProxyConfigChanged(new_config, CONFIG_VALID)); |
266 } | 269 } |
267 | 270 |
268 } // namespace net | 271 } // namespace net |
OLD | NEW |