Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: net/base/network_config_watcher_mac.h

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef NET_BASE_NETWORK_CONFIG_WATCHER_MAC_H_
6 #define NET_BASE_NETWORK_CONFIG_WATCHER_MAC_H_
7
8 #include <SystemConfiguration/SCDynamicStore.h>
9
10 #include "base/basictypes.h"
11 #include "base/mac/scoped_cftyperef.h"
12 #include "base/memory/scoped_ptr.h"
13
14 namespace base {
15 class Thread;
16 }
17
18 namespace net {
19
20 // Helper class for watching the Mac OS system network settings.
21 class NetworkConfigWatcherMac {
22 public:
23 // NOTE: The lifetime of Delegate is expected to exceed the lifetime of
24 // NetworkConfigWatcherMac.
25 class Delegate {
26 public:
27 virtual ~Delegate() {}
28
29 // Called to let the delegate do any setup work the must be run on the
30 // notifier thread immediately after it starts.
31 virtual void Init() {}
32
33 // Called to start receiving notifications from the SCNetworkReachability
34 // API.
35 // Will be called on the notifier thread.
36 virtual void StartReachabilityNotifications() = 0;
37
38 // Called to register the notification keys on |store|.
39 // Implementors are expected to call SCDynamicStoreSetNotificationKeys().
40 // Will be called on the notifier thread.
41 virtual void SetDynamicStoreNotificationKeys(SCDynamicStoreRef store) = 0;
42
43 // Called when one of the notification keys has changed.
44 // Will be called on the notifier thread.
45 virtual void OnNetworkConfigChange(CFArrayRef changed_keys) = 0;
46 };
47
48 explicit NetworkConfigWatcherMac(Delegate* delegate);
49 ~NetworkConfigWatcherMac();
50
51 private:
52 // The thread used to listen for notifications. This relays the notification
53 // to the registered observers without posting back to the thread the object
54 // was created on.
55 scoped_ptr<base::Thread> notifier_thread_;
56
57 DISALLOW_COPY_AND_ASSIGN(NetworkConfigWatcherMac);
58 };
59
60 } // namespace net
61
62 #endif // NET_BASE_NETWORK_CONFIG_WATCHER_MAC_H_
OLDNEW
« no previous file with comments | « net/base/network_change_notifier_win_unittest.cc ('k') | net/base/network_config_watcher_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698