Chromium Code Reviews| 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/base/network_change_notifier_mac.h" | 5 #include "net/base/network_change_notifier_mac.h" |
| 6 | 6 |
| 7 #include <netinet/in.h> | 7 #include <netinet/in.h> |
| 8 #include <resolv.h> | 8 #include <resolv.h> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 250 | 250 |
| 251 DCHECK_EQ(notifier_mac->run_loop_.get(), CFRunLoopGetCurrent()); | 251 DCHECK_EQ(notifier_mac->run_loop_.get(), CFRunLoopGetCurrent()); |
| 252 | 252 |
| 253 ConnectionType new_type = CalculateConnectionType(flags); | 253 ConnectionType new_type = CalculateConnectionType(flags); |
| 254 ConnectionType old_type; | 254 ConnectionType old_type; |
| 255 { | 255 { |
| 256 base::AutoLock lock(notifier_mac->connection_type_lock_); | 256 base::AutoLock lock(notifier_mac->connection_type_lock_); |
| 257 old_type = notifier_mac->connection_type_; | 257 old_type = notifier_mac->connection_type_; |
| 258 notifier_mac->connection_type_ = new_type; | 258 notifier_mac->connection_type_ = new_type; |
| 259 } | 259 } |
| 260 if (old_type != new_type) | 260 if (old_type != new_type) { |
| 261 NotifyObserversOfConnectionTypeChange(); | 261 NotifyObserversOfConnectionTypeChange(); |
| 262 double max_bandwidth = | |
| 263 new_type == CONNECTION_NONE | |
| 264 ? NetworkChangeNotifier::GetMaxBandwidthForConnectionSubtype( | |
|
pauljensen
2015/09/15 18:17:40
ditto
jkarlin
2015/09/16 12:12:22
Done.
| |
| 265 SUBTYPE_NONE) | |
| 266 : NetworkChangeNotifier::GetMaxBandwidthForConnectionSubtype( | |
| 267 SUBTYPE_UNKNOWN); | |
| 268 NotifyObserversOfMaxBandwidthChange(new_type, max_bandwidth); | |
| 269 } | |
| 262 | 270 |
| 263 #if defined(OS_IOS) | 271 #if defined(OS_IOS) |
| 264 // On iOS, the SCDynamicStore API does not exist, and we use the reachability | 272 // On iOS, the SCDynamicStore API does not exist, and we use the reachability |
| 265 // API to detect IP address changes instead. | 273 // API to detect IP address changes instead. |
| 266 NotifyObserversOfIPAddressChange(); | 274 NotifyObserversOfIPAddressChange(); |
| 267 #endif // defined(OS_IOS) | 275 #endif // defined(OS_IOS) |
| 268 } | 276 } |
| 269 | 277 |
| 270 } // namespace net | 278 } // namespace net |
| OLD | NEW |