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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 reachability_.reset(); | 189 reachability_.reset(); |
190 } | 190 } |
191 } | 191 } |
192 | 192 |
193 void NetworkChangeNotifierMac::SetDynamicStoreNotificationKeys( | 193 void NetworkChangeNotifierMac::SetDynamicStoreNotificationKeys( |
194 SCDynamicStoreRef store) { | 194 SCDynamicStoreRef store) { |
195 #if defined(OS_IOS) | 195 #if defined(OS_IOS) |
196 // SCDynamicStore API does not exist on iOS. | 196 // SCDynamicStore API does not exist on iOS. |
197 NOTREACHED(); | 197 NOTREACHED(); |
198 #else | 198 #else |
199 base::mac::ScopedCFTypeRef<CFMutableArrayRef> notification_keys( | 199 base::ScopedCFTypeRef<CFMutableArrayRef> notification_keys( |
200 CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks)); | 200 CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks)); |
201 base::mac::ScopedCFTypeRef<CFStringRef> key( | 201 base::ScopedCFTypeRef<CFStringRef> key( |
202 SCDynamicStoreKeyCreateNetworkGlobalEntity( | 202 SCDynamicStoreKeyCreateNetworkGlobalEntity( |
203 NULL, kSCDynamicStoreDomainState, kSCEntNetInterface)); | 203 NULL, kSCDynamicStoreDomainState, kSCEntNetInterface)); |
204 CFArrayAppendValue(notification_keys.get(), key.get()); | 204 CFArrayAppendValue(notification_keys.get(), key.get()); |
205 key.reset(SCDynamicStoreKeyCreateNetworkGlobalEntity( | 205 key.reset(SCDynamicStoreKeyCreateNetworkGlobalEntity( |
206 NULL, kSCDynamicStoreDomainState, kSCEntNetIPv4)); | 206 NULL, kSCDynamicStoreDomainState, kSCEntNetIPv4)); |
207 CFArrayAppendValue(notification_keys.get(), key.get()); | 207 CFArrayAppendValue(notification_keys.get(), key.get()); |
208 key.reset(SCDynamicStoreKeyCreateNetworkGlobalEntity( | 208 key.reset(SCDynamicStoreKeyCreateNetworkGlobalEntity( |
209 NULL, kSCDynamicStoreDomainState, kSCEntNetIPv6)); | 209 NULL, kSCDynamicStoreDomainState, kSCEntNetIPv6)); |
210 CFArrayAppendValue(notification_keys.get(), key.get()); | 210 CFArrayAppendValue(notification_keys.get(), key.get()); |
211 | 211 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 | 264 |
265 #if defined(OS_IOS) | 265 #if defined(OS_IOS) |
266 // On iOS, the SCDynamicStore API does not exist, and we use the reachability | 266 // On iOS, the SCDynamicStore API does not exist, and we use the reachability |
267 // API to detect IP address changes instead. | 267 // API to detect IP address changes instead. |
268 if (new_type != CONNECTION_NONE) | 268 if (new_type != CONNECTION_NONE) |
269 NotifyObserversOfIPAddressChange(); | 269 NotifyObserversOfIPAddressChange(); |
270 #endif // defined(OS_IOS) | 270 #endif // defined(OS_IOS) |
271 } | 271 } |
272 | 272 |
273 } // namespace net | 273 } // namespace net |
OLD | NEW |