Chromium Code Reviews| 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 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/observer_list_threadsafe.h" | 9 #include "base/observer_list_threadsafe.h" |
| 10 #include "net/base/net_export.h" | 10 #include "net/base/net_export.h" |
| 11 | 11 |
| 12 class GURL; | 12 class GURL; |
| 13 | 13 |
| 14 namespace net { | 14 namespace net { |
| 15 | 15 |
| 16 struct DnsConfig; | 16 struct DnsConfig; |
| 17 class HistogramWatcher; | 17 class HistogramWatcher; |
| 18 class NetworkChangeNotifierFactory; | 18 class NetworkChangeNotifierFactory; |
| 19 | 19 |
| 20 #if defined(OS_ANDROID) | |
|
szym
2012/09/14 19:07:29
You shouldn't need to forward declare for friend d
szym
2012/09/14 19:26:34
:( Apparently this is not true if you want to frie
szym
2012/09/14 19:28:38
Still, I wonder if you need #if defined.
gone
2012/09/15 01:01:55
Seems like it's fine to remove. Had some issues w
| |
| 21 namespace android { | |
| 22 class NetworkChangeNotifierAndroidTest; | |
| 23 } | |
| 24 #endif | |
| 25 | |
| 20 #if defined(OS_LINUX) | 26 #if defined(OS_LINUX) |
| 21 namespace internal { | 27 namespace internal { |
| 22 class AddressTrackerLinux; | 28 class AddressTrackerLinux; |
| 23 } | 29 } |
| 24 #endif | 30 #endif |
| 25 | 31 |
| 26 // NetworkChangeNotifier monitors the system for network changes, and notifies | 32 // NetworkChangeNotifier monitors the system for network changes, and notifies |
| 27 // registered observers of those events. Observers may register on any thread, | 33 // registered observers of those events. Observers may register on any thread, |
| 28 // and will be called back on the thread from which they registered. | 34 // and will be called back on the thread from which they registered. |
| 29 // NetworkChangeNotifiers are threadsafe, though they must be created and | 35 // NetworkChangeNotifiers are threadsafe, though they must be created and |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 190 static void NotifyObserversOfDNSChange(); | 196 static void NotifyObserversOfDNSChange(); |
| 191 | 197 |
| 192 // Stores |config| in NetworkState and notifies observers. | 198 // Stores |config| in NetworkState and notifies observers. |
| 193 static void SetDnsConfig(const DnsConfig& config); | 199 static void SetDnsConfig(const DnsConfig& config); |
| 194 | 200 |
| 195 private: | 201 private: |
| 196 friend class HostResolverImplDnsTest; | 202 friend class HostResolverImplDnsTest; |
| 197 friend class NetworkChangeNotifierLinuxTest; | 203 friend class NetworkChangeNotifierLinuxTest; |
| 198 friend class NetworkChangeNotifierWinTest; | 204 friend class NetworkChangeNotifierWinTest; |
| 199 | 205 |
| 206 #if defined(OS_ANDROID) | |
|
szym
2012/09/14 19:07:29
No need for #if here.
gone
2012/09/15 01:01:55
Done.
| |
| 207 friend class net::android::NetworkChangeNotifierAndroidTest; | |
| 208 #endif | |
| 209 | |
| 200 class NetworkState; | 210 class NetworkState; |
| 201 | 211 |
| 202 // Allows a second NetworkChangeNotifier to be created for unit testing, so | 212 // Allows a second NetworkChangeNotifier to be created for unit testing, so |
| 203 // the test suite can create a MockNetworkChangeNotifier, but platform | 213 // the test suite can create a MockNetworkChangeNotifier, but platform |
| 204 // specific NetworkChangeNotifiers can also be created for testing. To use, | 214 // specific NetworkChangeNotifiers can also be created for testing. To use, |
| 205 // create an DisableForTest object, and then create the new | 215 // create an DisableForTest object, and then create the new |
| 206 // NetworkChangeNotifier object. The NetworkChangeNotifier must be | 216 // NetworkChangeNotifier object. The NetworkChangeNotifier must be |
| 207 // destroyed before the DisableForTest object, as its destruction will restore | 217 // destroyed before the DisableForTest object, as its destruction will restore |
| 208 // the original NetworkChangeNotifier. | 218 // the original NetworkChangeNotifier. |
| 209 class NET_EXPORT_PRIVATE DisableForTest { | 219 class NET_EXPORT_PRIVATE DisableForTest { |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 228 | 238 |
| 229 // A little-piggy-back observer that simply logs UMA histogram data. | 239 // A little-piggy-back observer that simply logs UMA histogram data. |
| 230 scoped_ptr<HistogramWatcher> histogram_watcher_; | 240 scoped_ptr<HistogramWatcher> histogram_watcher_; |
| 231 | 241 |
| 232 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier); | 242 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier); |
| 233 }; | 243 }; |
| 234 | 244 |
| 235 } // namespace net | 245 } // namespace net |
| 236 | 246 |
| 237 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ | 247 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ |
| OLD | NEW |