OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef NET_BASE_NETWORK_CHANGE_NOTIFIER_MAC_H_ | 5 #ifndef NET_BASE_NETWORK_CHANGE_NOTIFIER_MAC_H_ |
6 #define NET_BASE_NETWORK_CHANGE_NOTIFIER_MAC_H_ | 6 #define NET_BASE_NETWORK_CHANGE_NOTIFIER_MAC_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <SystemConfiguration/SCDynamicStore.h> | 9 #include <SystemConfiguration/SCDynamicStore.h> |
| 10 #include <SystemConfiguration/SCNetworkReachability.h> |
10 | 11 |
11 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/mac/scoped_cftyperef.h" |
12 #include "net/base/network_change_notifier.h" | 14 #include "net/base/network_change_notifier.h" |
13 #include "net/base/network_config_watcher_mac.h" | 15 #include "net/base/network_config_watcher_mac.h" |
14 | 16 |
15 namespace net { | 17 namespace net { |
16 | 18 |
17 class NetworkChangeNotifierMac: public NetworkChangeNotifier { | 19 class NetworkChangeNotifierMac: public NetworkChangeNotifier { |
18 public: | 20 public: |
19 NetworkChangeNotifierMac(); | 21 NetworkChangeNotifierMac(); |
20 virtual ~NetworkChangeNotifierMac(); | 22 virtual ~NetworkChangeNotifierMac(); |
21 | 23 |
(...skipping 18 matching lines...) Expand all Loading... |
40 | 42 |
41 private: | 43 private: |
42 NetworkChangeNotifierMac* const net_config_watcher_; | 44 NetworkChangeNotifierMac* const net_config_watcher_; |
43 DISALLOW_COPY_AND_ASSIGN(Forwarder); | 45 DISALLOW_COPY_AND_ASSIGN(Forwarder); |
44 }; | 46 }; |
45 | 47 |
46 // NetworkConfigWatcherMac::Delegate implementation: | 48 // NetworkConfigWatcherMac::Delegate implementation: |
47 void SetDynamicStoreNotificationKeys(SCDynamicStoreRef store); | 49 void SetDynamicStoreNotificationKeys(SCDynamicStoreRef store); |
48 void OnNetworkConfigChange(CFArrayRef changed_keys); | 50 void OnNetworkConfigChange(CFArrayRef changed_keys); |
49 | 51 |
| 52 static void ReachabilityCallback(SCNetworkReachabilityRef target, |
| 53 SCNetworkConnectionFlags flags, |
| 54 void* notifier); |
| 55 |
50 Forwarder forwarder_; | 56 Forwarder forwarder_; |
51 const NetworkConfigWatcherMac config_watcher_; | 57 const NetworkConfigWatcherMac config_watcher_; |
| 58 CFRunLoopRef run_loop_; |
| 59 base::mac::ScopedCFTypeRef<SCNetworkReachabilityRef> reachability_; |
| 60 bool network_reachable_; |
52 | 61 |
53 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierMac); | 62 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierMac); |
54 }; | 63 }; |
55 | 64 |
56 } // namespace net | 65 } // namespace net |
57 | 66 |
58 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_MAC_H_ | 67 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_MAC_H_ |
OLD | NEW |