summaryrefslogtreecommitdiffstats
path: root/net/base/network_config_watcher_mac.h
diff options
context:
space:
mode:
Diffstat (limited to 'net/base/network_config_watcher_mac.h')
-rw-r--r--net/base/network_config_watcher_mac.h36
1 files changed, 17 insertions, 19 deletions
diff --git a/net/base/network_config_watcher_mac.h b/net/base/network_config_watcher_mac.h
index 78f06a5..71fb825 100644
--- a/net/base/network_config_watcher_mac.h
+++ b/net/base/network_config_watcher_mac.h
@@ -21,26 +21,26 @@ namespace net {
// Base class for watching the Mac OS system network settings.
class NetworkConfigWatcherMac : public MessageLoop::DestructionObserver {
public:
- // NOTE: The lifetime of Delegate is expected to exceed the lifetime of
- // NetworkConfigWatcherMac.
- class Delegate {
- public:
- virtual ~Delegate() {}
-
- // Called to register the notification keys on |store|.
- // Implementors are expected to call SCDynamicStoreSetNotificationKeys().
- // Will be called on the notifier thread.
- virtual void SetDynamicStoreNotificationKeys(SCDynamicStoreRef store) = 0;
-
- // Called when one of the notification keys has changed.
- // Will be called on the notifier thread.
- virtual void OnNetworkConfigChange(CFArrayRef changed_keys) = 0;
- };
-
- explicit NetworkConfigWatcherMac(Delegate* delegate);
+ NetworkConfigWatcherMac();
+
+ protected:
virtual ~NetworkConfigWatcherMac();
+ // Called to register the notification keys on |store|.
+ // Implementors are expected to call SCDynamicStoreSetNotificationKeys().
+ // Will be called on the notifier thread.
+ virtual void SetDynamicStoreNotificationKeys(SCDynamicStoreRef store) = 0;
+
+ // Called when one of the notification keys has changed.
+ // Will be called on the notifier thread.
+ virtual void OnNetworkConfigChange(CFArrayRef changed_keys) = 0;
+
private:
+ // Called back by OS. Calls OnNetworkConfigChange().
+ static void DynamicStoreCallback(SCDynamicStoreRef /* store */,
+ CFArrayRef changed_keys,
+ void* config);
+
// MessageLoop::DestructionObserver:
virtual void WillDestroyCurrentMessageLoop();
@@ -57,8 +57,6 @@ class NetworkConfigWatcherMac : public MessageLoop::DestructionObserver {
scoped_cftyperef<CFRunLoopSourceRef> run_loop_source_;
- Delegate* const delegate_;
-
DISALLOW_COPY_AND_ASSIGN(NetworkConfigWatcherMac);
};