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 <unordered_set> |
| 9 |
8 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
9 #include "base/containers/hash_tables.h" | |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "net/base/net_export.h" | 13 #include "net/base/net_export.h" |
13 #include "net/base/network_change_notifier.h" | 14 #include "net/base/network_change_notifier.h" |
14 | 15 |
15 namespace net { | 16 namespace net { |
16 | 17 |
17 class NET_EXPORT_PRIVATE NetworkChangeNotifierLinux | 18 class NET_EXPORT_PRIVATE NetworkChangeNotifierLinux |
18 : public NetworkChangeNotifier { | 19 : public NetworkChangeNotifier { |
19 public: | 20 public: |
20 // Creates NetworkChangeNotifierLinux with a list of ignored interfaces. | 21 // Creates NetworkChangeNotifierLinux with a list of ignored interfaces. |
21 // |ignored_interfaces| is the list of interfaces to ignore. An ignored | 22 // |ignored_interfaces| is the list of interfaces to ignore. An ignored |
22 // interface will not trigger IP address or connection type notifications. | 23 // interface will not trigger IP address or connection type notifications. |
23 // NOTE: Only ignore interfaces not used to connect to the internet. Adding | 24 // NOTE: Only ignore interfaces not used to connect to the internet. Adding |
24 // interfaces used to connect to the internet can cause critical network | 25 // interfaces used to connect to the internet can cause critical network |
25 // changed signals to be lost allowing incorrect stale state to persist. | 26 // changed signals to be lost allowing incorrect stale state to persist. |
26 explicit NetworkChangeNotifierLinux( | 27 explicit NetworkChangeNotifierLinux( |
27 const base::hash_set<std::string>& ignored_interfaces); | 28 const std::unordered_set<std::string>& ignored_interfaces); |
28 | 29 |
29 private: | 30 private: |
30 class Thread; | 31 class Thread; |
31 | 32 |
32 ~NetworkChangeNotifierLinux() override; | 33 ~NetworkChangeNotifierLinux() override; |
33 static NetworkChangeCalculatorParams NetworkChangeCalculatorParamsLinux(); | 34 static NetworkChangeCalculatorParams NetworkChangeCalculatorParamsLinux(); |
34 | 35 |
35 // NetworkChangeNotifier: | 36 // NetworkChangeNotifier: |
36 ConnectionType GetCurrentConnectionType() const override; | 37 ConnectionType GetCurrentConnectionType() const override; |
37 | 38 |
38 const internal::AddressTrackerLinux* GetAddressTrackerInternal() | 39 const internal::AddressTrackerLinux* GetAddressTrackerInternal() |
39 const override; | 40 const override; |
40 | 41 |
41 // The thread used to listen for notifications. This relays the notification | 42 // The thread used to listen for notifications. This relays the notification |
42 // to the registered observers without posting back to the thread the object | 43 // to the registered observers without posting back to the thread the object |
43 // was created on. | 44 // was created on. |
44 // Also used for DnsConfigService which requires TYPE_IO message loop. | 45 // Also used for DnsConfigService which requires TYPE_IO message loop. |
45 scoped_ptr<Thread> notifier_thread_; | 46 scoped_ptr<Thread> notifier_thread_; |
46 | 47 |
47 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierLinux); | 48 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierLinux); |
48 }; | 49 }; |
49 | 50 |
50 } // namespace net | 51 } // namespace net |
51 | 52 |
52 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_LINUX_H_ | 53 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_LINUX_H_ |
OLD | NEW |