Index: net/base/network_change_notifier.h |
diff --git a/net/base/network_change_notifier.h b/net/base/network_change_notifier.h |
index 6b801bc7c424ead6326bde9bd2441bfeca4e30f9..01a38f4439be7708ca83616e58fbe57c97162e28 100644 |
--- a/net/base/network_change_notifier.h |
+++ b/net/base/network_change_notifier.h |
@@ -5,7 +5,10 @@ |
#ifndef NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ |
#define NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ |
+#include <vector> |
+ |
#include "base/basictypes.h" |
+#include "base/gtest_prod_util.h" |
#include "base/observer_list_threadsafe.h" |
#include "base/time/time.h" |
#include "net/base/net_export.h" |
pauljensen
2014/06/20 05:58:53
Sadly I cannot include net_util.h here because it
|
@@ -17,6 +20,8 @@ namespace net { |
struct DnsConfig; |
class HistogramWatcher; |
class NetworkChangeNotifierFactory; |
+struct NetworkInterface; |
+typedef std::vector<NetworkInterface> NetworkInterfaceList; |
pauljensen
2014/06/20 05:58:53
This is sadly necessary because net_util.h include
mmenke
2014/06/20 15:18:57
Ugly, but fine for now. I'd argue it may make sen
|
class URLRequest; |
#if defined(OS_LINUX) |
@@ -300,15 +305,26 @@ class NET_EXPORT NetworkChangeNotifier { |
// Stores |config| in NetworkState and notifies observers. |
static void SetDnsConfig(const DnsConfig& config); |
+ // Infer connection type from |GetNetworkList|. If all network interfaces have |
+ // the same type, return it, otherwise return CONNECTION_UNKNOWN. |
+ static ConnectionType ConnectionTypeFromInterfaces(); |
+ |
private: |
friend class HostResolverImplDnsTest; |
friend class NetworkChangeNotifierAndroidTest; |
friend class NetworkChangeNotifierLinuxTest; |
friend class NetworkChangeNotifierWinTest; |
+ FRIEND_TEST_ALL_PREFIXES(NetworkChangeNotifierTest, |
+ InterfacesToConnectionType); |
class NetworkState; |
class NetworkChangeCalculator; |
+ // Infer connection type from |list|. If all network interfaces have |
+ // the same type, return it, otherwise return CONNECTION_UNKNOWN. |
+ static ConnectionType ConnectionTypeFromInterfaceList( |
+ const NetworkInterfaceList& interfaces); |
+ |
const scoped_refptr<ObserverListThreadSafe<IPAddressObserver> > |
ip_address_observer_list_; |
const scoped_refptr<ObserverListThreadSafe<ConnectionTypeObserver> > |