OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_LINUX_H_ | 5 #ifndef NET_BASE_NETWORK_CHANGE_NOTIFIER_LINUX_H_ |
6 #define NET_BASE_NETWORK_CHANGE_NOTIFIER_LINUX_H_ | 6 #define NET_BASE_NETWORK_CHANGE_NOTIFIER_LINUX_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "net/base/net_export.h" | 11 #include "net/base/net_export.h" |
12 #include "net/base/network_change_notifier.h" | 12 #include "net/base/network_change_notifier.h" |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 | 15 |
16 class NET_EXPORT_PRIVATE NetworkChangeNotifierLinux | 16 class NET_EXPORT_PRIVATE NetworkChangeNotifierLinux |
17 : public NetworkChangeNotifier { | 17 : public NetworkChangeNotifier { |
18 public: | 18 public: |
19 static NetworkChangeNotifierLinux* Create(); | 19 static NetworkChangeNotifierLinux* Create(); |
20 static NetworkChangeNotifierLinux* GetInstance(); | |
pauljensen
2014/11/21 18:55:36
Accessing static instances is discouraged. Please
derekjchow1
2014/11/21 23:13:58
Done.
| |
21 | |
22 // Adds/removes a netif name to ignore. Returns true if success. | |
23 bool AddNetifToIgnore(const std::string& netif_name); | |
24 bool RemoveNetifToIgnore(const std::string& netif_name); | |
pauljensen
2014/11/21 18:55:36
I see no motivation for adding these APIs. Please
derekjchow1
2014/11/21 23:13:58
Done.
| |
25 | |
26 // Returns message loop proxy for own IO thread. | |
27 scoped_refptr<base::MessageLoopProxy> GetMessageLoopProxy() const; | |
pauljensen
2014/11/21 18:55:36
I don't think we should be exposing this.
derekjchow1
2014/11/21 23:13:58
Done.
| |
28 | |
29 std::string GetPrimaryNetif() const; | |
20 | 30 |
21 private: | 31 private: |
22 class Thread; | 32 class Thread; |
23 | 33 |
24 NetworkChangeNotifierLinux(); | 34 NetworkChangeNotifierLinux(); |
25 ~NetworkChangeNotifierLinux() override; | 35 ~NetworkChangeNotifierLinux() override; |
26 static NetworkChangeCalculatorParams NetworkChangeCalculatorParamsLinux(); | 36 static NetworkChangeCalculatorParams NetworkChangeCalculatorParamsLinux(); |
27 | 37 |
28 // NetworkChangeNotifier: | 38 // NetworkChangeNotifier: |
29 ConnectionType GetCurrentConnectionType() const override; | 39 ConnectionType GetCurrentConnectionType() const override; |
30 | 40 |
31 const internal::AddressTrackerLinux* GetAddressTrackerInternal() | 41 const internal::AddressTrackerLinux* GetAddressTrackerInternal() |
32 const override; | 42 const override; |
33 | 43 |
34 // The thread used to listen for notifications. This relays the notification | 44 // The thread used to listen for notifications. This relays the notification |
35 // to the registered observers without posting back to the thread the object | 45 // to the registered observers without posting back to the thread the object |
36 // was created on. | 46 // was created on. |
37 // Also used for DnsConfigService which requires TYPE_IO message loop. | 47 // Also used for DnsConfigService which requires TYPE_IO message loop. |
38 scoped_ptr<Thread> notifier_thread_; | 48 scoped_ptr<Thread> notifier_thread_; |
39 | 49 |
40 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierLinux); | 50 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierLinux); |
41 }; | 51 }; |
42 | 52 |
43 } // namespace net | 53 } // namespace net |
44 | 54 |
45 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_LINUX_H_ | 55 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_LINUX_H_ |
OLD | NEW |