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_H_ | 5 #ifndef NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ |
6 #define NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ | 6 #define NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/observer_list_threadsafe.h" | 10 #include "base/observer_list_threadsafe.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 CONNECTION_ETHERNET, | 45 CONNECTION_ETHERNET, |
46 CONNECTION_WIFI, | 46 CONNECTION_WIFI, |
47 CONNECTION_2G, | 47 CONNECTION_2G, |
48 CONNECTION_3G, | 48 CONNECTION_3G, |
49 CONNECTION_4G, | 49 CONNECTION_4G, |
50 CONNECTION_NONE // No connection. | 50 CONNECTION_NONE // No connection. |
51 }; | 51 }; |
52 | 52 |
53 class NET_EXPORT IPAddressObserver { | 53 class NET_EXPORT IPAddressObserver { |
54 public: | 54 public: |
55 virtual ~IPAddressObserver() {} | |
56 | |
57 // Will be called when the IP address of the primary interface changes. | 55 // Will be called when the IP address of the primary interface changes. |
58 // This includes when the primary interface itself changes. | 56 // This includes when the primary interface itself changes. |
59 virtual void OnIPAddressChanged() = 0; | 57 virtual void OnIPAddressChanged() = 0; |
60 | 58 |
61 protected: | 59 protected: |
62 IPAddressObserver() {} | 60 IPAddressObserver() {} |
| 61 virtual ~IPAddressObserver() {} |
63 | 62 |
64 private: | 63 private: |
65 DISALLOW_COPY_AND_ASSIGN(IPAddressObserver); | 64 DISALLOW_COPY_AND_ASSIGN(IPAddressObserver); |
66 }; | 65 }; |
67 | 66 |
68 class NET_EXPORT ConnectionTypeObserver { | 67 class NET_EXPORT ConnectionTypeObserver { |
69 public: | 68 public: |
70 virtual ~ConnectionTypeObserver() {} | 69 // Will be called when the connection type of the system has changed. |
71 | 70 // See NetworkChangeNotifier::GetConnectionType() for important caveats |
72 // Will be called when the connection type of the system has changed. | 71 // about the unreliability of using this signal to infer the ability to |
73 // See NetworkChangeNotifier::GetConnectionType() for important caveats | 72 // reach remote sites. |
74 // about the unreliability of using this signal to infer the ability to | |
75 // reach remote sites. | |
76 virtual void OnConnectionTypeChanged(ConnectionType type) = 0; | 73 virtual void OnConnectionTypeChanged(ConnectionType type) = 0; |
77 | 74 |
78 protected: | 75 protected: |
79 ConnectionTypeObserver() {} | 76 ConnectionTypeObserver() {} |
| 77 virtual ~ConnectionTypeObserver() {} |
80 | 78 |
81 private: | 79 private: |
82 DISALLOW_COPY_AND_ASSIGN(ConnectionTypeObserver); | 80 DISALLOW_COPY_AND_ASSIGN(ConnectionTypeObserver); |
83 }; | 81 }; |
84 | 82 |
85 class NET_EXPORT DNSObserver { | 83 class NET_EXPORT DNSObserver { |
86 public: | 84 public: |
87 virtual ~DNSObserver() {} | |
88 | |
89 // Will be called when the DNS settings of the system may have changed. | 85 // Will be called when the DNS settings of the system may have changed. |
90 // The flags set in |detail| provide the specific set of changes. | 86 // The flags set in |detail| provide the specific set of changes. |
91 virtual void OnDNSChanged(unsigned detail) = 0; | 87 virtual void OnDNSChanged(unsigned detail) = 0; |
92 | 88 |
93 protected: | 89 protected: |
94 DNSObserver() {} | 90 DNSObserver() {} |
| 91 virtual ~DNSObserver() {} |
95 | 92 |
96 private: | 93 private: |
97 DISALLOW_COPY_AND_ASSIGN(DNSObserver); | 94 DISALLOW_COPY_AND_ASSIGN(DNSObserver); |
98 }; | 95 }; |
99 | 96 |
100 virtual ~NetworkChangeNotifier(); | 97 virtual ~NetworkChangeNotifier(); |
101 | 98 |
102 // See the description of NetworkChangeNotifier::GetConnectionType(). | 99 // See the description of NetworkChangeNotifier::GetConnectionType(). |
103 // Implementations must be thread-safe. Implementations must also be | 100 // Implementations must be thread-safe. Implementations must also be |
104 // cheap as this could be called (repeatedly) from the IO thread. | 101 // cheap as this could be called (repeatedly) from the IO thread. |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 // http://crbug.com/116139 | 211 // http://crbug.com/116139 |
215 base::Lock watching_dns_lock_; | 212 base::Lock watching_dns_lock_; |
216 bool watching_dns_; | 213 bool watching_dns_; |
217 | 214 |
218 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier); | 215 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier); |
219 }; | 216 }; |
220 | 217 |
221 } // namespace net | 218 } // namespace net |
222 | 219 |
223 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ | 220 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ |
OLD | NEW |