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