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/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 <SystemConfiguration/SCDynamicStoreKey.h> | 8 #include <SystemConfiguration/SCDynamicStoreKey.h> |
9 #include <SystemConfiguration/SCNetworkReachability.h> | 9 #include <SystemConfiguration/SCNetworkReachability.h> |
10 #include <SystemConfiguration/SCSchemaDefinitions.h> | 10 #include <SystemConfiguration/SCSchemaDefinitions.h> |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 NetworkChangeNotifierMac* notifier_mac = | 115 NetworkChangeNotifierMac* notifier_mac = |
116 static_cast<NetworkChangeNotifierMac*>(notifier); | 116 static_cast<NetworkChangeNotifierMac*>(notifier); |
117 | 117 |
118 DCHECK_EQ(notifier_mac->run_loop_.get(), CFRunLoopGetCurrent()); | 118 DCHECK_EQ(notifier_mac->run_loop_.get(), CFRunLoopGetCurrent()); |
119 | 119 |
120 bool reachable = flags & kSCNetworkFlagsReachable; | 120 bool reachable = flags & kSCNetworkFlagsReachable; |
121 bool connection_required = flags & kSCNetworkFlagsConnectionRequired; | 121 bool connection_required = flags & kSCNetworkFlagsConnectionRequired; |
122 bool old_reachability = notifier_mac->network_reachable_; | 122 bool old_reachability = notifier_mac->network_reachable_; |
123 notifier_mac->network_reachable_ = reachable && !connection_required; | 123 notifier_mac->network_reachable_ = reachable && !connection_required; |
124 if (old_reachability != notifier_mac->network_reachable_) | 124 if (old_reachability != notifier_mac->network_reachable_) |
125 notifier_mac->NotifyObserversOfOnlineStateChange(); | 125 NotifyObserversOfOnlineStateChange(); |
126 } | 126 } |
127 | 127 |
128 } // namespace net | 128 } // namespace net |
OLD | NEW |