summaryrefslogtreecommitdiffstats
path: root/net/base/network_config_watcher_mac.h
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-07 19:41:36 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-07 19:41:36 +0000
commit6688a4965904d54c252f563e0b0165232e28173c (patch)
treec43df23b1dd27166539c73924d34e17f81d60a35 /net/base/network_config_watcher_mac.h
parentab6d1223c9e957d9f179327cd6016ac1780d23fe (diff)
downloadchromium_src-6688a4965904d54c252f563e0b0165232e28173c.zip
chromium_src-6688a4965904d54c252f563e0b0165232e28173c.tar.gz
chromium_src-6688a4965904d54c252f563e0b0165232e28173c.tar.bz2
Reland r58230.
Simple 2-line fix. BUG=53138 TEST=Make sure ethernet is plugged in. Run Chrome. Unplug ethernet. Does not crash. Review URL: http://codereview.chromium.org/3371001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58736 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/network_config_watcher_mac.h')
-rw-r--r--net/base/network_config_watcher_mac.h36
1 files changed, 19 insertions, 17 deletions
diff --git a/net/base/network_config_watcher_mac.h b/net/base/network_config_watcher_mac.h
index 71fb825..78f06a5 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:
- NetworkConfigWatcherMac();
-
- protected:
+ // 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);
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,6 +57,8 @@ class NetworkConfigWatcherMac : public MessageLoop::DestructionObserver {
scoped_cftyperef<CFRunLoopSourceRef> run_loop_source_;
+ Delegate* const delegate_;
+
DISALLOW_COPY_AND_ASSIGN(NetworkConfigWatcherMac);
};