Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Unified Diff: net/base/network_change_notifier.h

Issue 298023005: Infer network connection type from network interface type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add tests Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/base/network_change_notifier.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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> >
« no previous file with comments | « no previous file | net/base/network_change_notifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698