| 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" |
| 14 #include "base/threading/platform_thread.h" |
| 12 #include "net/base/network_change_notifier.h" | 15 #include "net/base/network_change_notifier.h" |
| 13 #include "net/base/network_config_watcher_mac.h" | 16 #include "net/base/network_config_watcher_mac.h" |
| 14 | 17 |
| 15 namespace net { | 18 namespace net { |
| 16 | 19 |
| 17 class NetworkChangeNotifierMac: public NetworkChangeNotifier { | 20 class NetworkChangeNotifierMac: public NetworkChangeNotifier { |
| 18 public: | 21 public: |
| 19 NetworkChangeNotifierMac(); | 22 NetworkChangeNotifierMac(); |
| 20 virtual ~NetworkChangeNotifierMac(); | 23 virtual ~NetworkChangeNotifierMac(); |
| 21 | 24 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 40 | 43 |
| 41 private: | 44 private: |
| 42 NetworkChangeNotifierMac* const net_config_watcher_; | 45 NetworkChangeNotifierMac* const net_config_watcher_; |
| 43 DISALLOW_COPY_AND_ASSIGN(Forwarder); | 46 DISALLOW_COPY_AND_ASSIGN(Forwarder); |
| 44 }; | 47 }; |
| 45 | 48 |
| 46 // NetworkConfigWatcherMac::Delegate implementation: | 49 // NetworkConfigWatcherMac::Delegate implementation: |
| 47 void SetDynamicStoreNotificationKeys(SCDynamicStoreRef store); | 50 void SetDynamicStoreNotificationKeys(SCDynamicStoreRef store); |
| 48 void OnNetworkConfigChange(CFArrayRef changed_keys); | 51 void OnNetworkConfigChange(CFArrayRef changed_keys); |
| 49 | 52 |
| 53 static void ReachabilityCallback(SCNetworkReachabilityRef target, |
| 54 SCNetworkConnectionFlags flags, |
| 55 void* notifier); |
| 56 |
| 50 Forwarder forwarder_; | 57 Forwarder forwarder_; |
| 51 const NetworkConfigWatcherMac config_watcher_; | 58 const NetworkConfigWatcherMac config_watcher_; |
| 59 CFRunLoopRef run_loop_; |
| 60 base::mac::ScopedCFTypeRef<SCNetworkReachabilityRef> reachability_; |
| 61 bool network_reachable_; |
| 62 base::PlatformThreadId notifier_thread_id_; |
| 52 | 63 |
| 53 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierMac); | 64 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierMac); |
| 54 }; | 65 }; |
| 55 | 66 |
| 56 } // namespace net | 67 } // namespace net |
| 57 | 68 |
| 58 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_MAC_H_ | 69 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_MAC_H_ |
| OLD | NEW |