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 22 matching lines...) Expand all Loading... | |
33 // The HOSTS file has changed. | 33 // The HOSTS file has changed. |
34 CHANGE_DNS_HOSTS = 1 << 1, | 34 CHANGE_DNS_HOSTS = 1 << 1, |
35 // The watcher has started. | 35 // The watcher has started. |
36 CHANGE_DNS_WATCH_STARTED = 1 << 2, | 36 CHANGE_DNS_WATCH_STARTED = 1 << 2, |
37 // The watcher has failed and will not be available until further notice. | 37 // The watcher has failed and will not be available until further notice. |
38 CHANGE_DNS_WATCH_FAILED = 1 << 3, | 38 CHANGE_DNS_WATCH_FAILED = 1 << 3, |
39 }; | 39 }; |
40 | 40 |
41 class NET_EXPORT IPAddressObserver { | 41 class NET_EXPORT IPAddressObserver { |
42 public: | 42 public: |
43 virtual ~IPAddressObserver() {} | |
44 | |
45 // Will be called when the IP address of the primary interface changes. | 43 // Will be called when the IP address of the primary interface changes. |
46 // This includes when the primary interface itself changes. | 44 // This includes when the primary interface itself changes. |
47 virtual void OnIPAddressChanged() = 0; | 45 virtual void OnIPAddressChanged() = 0; |
48 | 46 |
49 protected: | 47 protected: |
50 IPAddressObserver() {} | 48 IPAddressObserver() {} |
49 virtual ~IPAddressObserver() {} | |
51 | 50 |
52 private: | 51 private: |
53 DISALLOW_COPY_AND_ASSIGN(IPAddressObserver); | 52 DISALLOW_COPY_AND_ASSIGN(IPAddressObserver); |
54 }; | 53 }; |
55 | 54 |
56 class NET_EXPORT OnlineStateObserver { | 55 class NET_EXPORT OnlineStateObserver { |
57 public: | 56 public: |
58 virtual ~OnlineStateObserver() {} | |
59 | |
60 // Will be called when the online state of the system may have changed. | 57 // Will be called when the online state of the system may have changed. |
61 // See NetworkChangeNotifier::IsOffline() for important caveats about | 58 // See NetworkChangeNotifier::IsOffline() for important caveats about |
62 // the unreliability of this signal. | 59 // the unreliability of this signal. |
63 virtual void OnOnlineStateChanged(bool online) = 0; | 60 virtual void OnOnlineStateChanged(bool online) = 0; |
64 | 61 |
65 protected: | 62 protected: |
66 OnlineStateObserver() {} | 63 OnlineStateObserver() {} |
64 virtual ~OnlineStateObserver() {} | |
willchan no longer on Chromium
2012/05/21 14:31:08
These types aren't refcounted, why are their destr
| |
67 | 65 |
68 private: | 66 private: |
69 DISALLOW_COPY_AND_ASSIGN(OnlineStateObserver); | 67 DISALLOW_COPY_AND_ASSIGN(OnlineStateObserver); |
70 }; | 68 }; |
71 | 69 |
72 class NET_EXPORT DNSObserver { | 70 class NET_EXPORT DNSObserver { |
73 public: | 71 public: |
74 virtual ~DNSObserver() {} | |
75 | |
76 // Will be called when the DNS settings of the system may have changed. | 72 // Will be called when the DNS settings of the system may have changed. |
77 // The flags set in |detail| provide the specific set of changes. | 73 // The flags set in |detail| provide the specific set of changes. |
78 virtual void OnDNSChanged(unsigned detail) = 0; | 74 virtual void OnDNSChanged(unsigned detail) = 0; |
79 | 75 |
80 protected: | 76 protected: |
81 DNSObserver() {} | 77 DNSObserver() {} |
78 virtual ~DNSObserver() {} | |
82 | 79 |
83 private: | 80 private: |
84 DISALLOW_COPY_AND_ASSIGN(DNSObserver); | 81 DISALLOW_COPY_AND_ASSIGN(DNSObserver); |
85 }; | 82 }; |
86 | 83 |
87 virtual ~NetworkChangeNotifier(); | 84 virtual ~NetworkChangeNotifier(); |
88 | 85 |
89 // See the description of NetworkChangeNotifier::IsOffline(). | 86 // See the description of NetworkChangeNotifier::IsOffline(). |
90 // Implementations must be thread-safe. Implementations must also be | 87 // Implementations must be thread-safe. Implementations must also be |
91 // cheap as this could be called (repeatedly) from the IO thread. | 88 // cheap as this could be called (repeatedly) from the IO thread. |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
190 // http://crbug.com/116139 | 187 // http://crbug.com/116139 |
191 base::Lock watching_dns_lock_; | 188 base::Lock watching_dns_lock_; |
192 bool watching_dns_; | 189 bool watching_dns_; |
193 | 190 |
194 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier); | 191 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier); |
195 }; | 192 }; |
196 | 193 |
197 } // namespace net | 194 } // namespace net |
198 | 195 |
199 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ | 196 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ |
OLD | NEW |