• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2009 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_CHANGE_NOTIFIER_MAC_H_
6 #define NET_BASE_NETWORK_CHANGE_NOTIFIER_MAC_H_
7 
8 #include "base/basictypes.h"
9 #include "base/ref_counted.h"
10 #include "base/scoped_ptr.h"
11 #include "net/base/network_change_notifier.h"
12 #include "net/base/network_change_notifier_helper.h"
13 
14 namespace base {
15 class Thread;
16 }  // namespace base
17 
18 namespace net {
19 
20 class NetworkChangeNotifierMac : public NetworkChangeNotifier {
21  public:
22   NetworkChangeNotifierMac();
23 
OnIPAddressChanged()24   void OnIPAddressChanged() { helper_.OnIPAddressChanged(); }
25 
26   // NetworkChangeNotifier methods:
27 
AddObserver(Observer * observer)28   virtual void AddObserver(Observer* observer) {
29     helper_.AddObserver(observer);
30   }
31 
RemoveObserver(Observer * observer)32   virtual void RemoveObserver(Observer* observer) {
33     helper_.RemoveObserver(observer);
34   }
35 
36  private:
37   friend class base::RefCounted<NetworkChangeNotifierMac>;
38 
39   virtual ~NetworkChangeNotifierMac();
40 
41   // Receives the OS X network change notifications on this thread.
42   const scoped_ptr<base::Thread> notifier_thread_;
43 
44   internal::NetworkChangeNotifierHelper helper_;
45 
46   DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierMac);
47 };
48 
49 }  // namespace net
50 
51 #endif  // NET_BASE_NETWORK_CHANGE_NOTIFIER_MAC_H_
52