OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 NetworkChangeNotifier(); | 129 NetworkChangeNotifier(); |
130 | 130 |
131 // Broadcasts a notification to all registered observers. Note that this | 131 // Broadcasts a notification to all registered observers. Note that this |
132 // happens asynchronously, even for observers on the current thread, even in | 132 // happens asynchronously, even for observers on the current thread, even in |
133 // tests. | 133 // tests. |
134 static void NotifyObserversOfIPAddressChange(); | 134 static void NotifyObserversOfIPAddressChange(); |
135 static void NotifyObserversOfOnlineStateChange(); | 135 static void NotifyObserversOfOnlineStateChange(); |
136 static void NotifyObserversOfDNSChange(); | 136 static void NotifyObserversOfDNSChange(); |
137 | 137 |
138 private: | 138 private: |
| 139 friend class NetworkChangeNotifierLinuxTest; |
139 friend class NetworkChangeNotifierWinTest; | 140 friend class NetworkChangeNotifierWinTest; |
140 | 141 |
141 // Allows a second NetworkChangeNotifier to be created for unit testing, so | 142 // Allows a second NetworkChangeNotifier to be created for unit testing, so |
142 // the test suite can create a MockNetworkChangeNotifier, but platform | 143 // the test suite can create a MockNetworkChangeNotifier, but platform |
143 // specific NetworkChangeNotifiers can also be created for testing. To use, | 144 // specific NetworkChangeNotifiers can also be created for testing. To use, |
144 // create an DisableForTest object, and then create the new | 145 // create an DisableForTest object, and then create the new |
145 // NetworkChangeNotifier object. The NetworkChangeNotifier must be | 146 // NetworkChangeNotifier object. The NetworkChangeNotifier must be |
146 // destroyed before the DisableForTest object, as its destruction will restore | 147 // destroyed before the DisableForTest object, as its destruction will restore |
147 // the original NetworkChangeNotifier. | 148 // the original NetworkChangeNotifier. |
148 class NET_EXPORT_PRIVATE DisableForTest { | 149 class NET_EXPORT_PRIVATE DisableForTest { |
(...skipping 12 matching lines...) Expand all Loading... |
161 online_state_observer_list_; | 162 online_state_observer_list_; |
162 const scoped_refptr<ObserverListThreadSafe<DNSObserver> > | 163 const scoped_refptr<ObserverListThreadSafe<DNSObserver> > |
163 resolver_state_observer_list_; | 164 resolver_state_observer_list_; |
164 | 165 |
165 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier); | 166 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier); |
166 }; | 167 }; |
167 | 168 |
168 } // namespace net | 169 } // namespace net |
169 | 170 |
170 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ | 171 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ |
OLD | NEW |