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

Unified Diff: net/base/network_change_notifier.h

Issue 1454313002: Adding platform support check for NetworkObserver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@home
Patch Set: Addresses pauljensen's comments Created 5 years, 1 month 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
Index: net/base/network_change_notifier.h
diff --git a/net/base/network_change_notifier.h b/net/base/network_change_notifier.h
index 4290331cddf259652a26253a3aa797a2fa69f011..ef699f001951fd744d74f04c2cd430c9d9e5b723 100644
--- a/net/base/network_change_notifier.h
+++ b/net/base/network_change_notifier.h
@@ -291,16 +291,21 @@ class NET_EXPORT NetworkChangeNotifier {
// TODO(jkarlin): Rename to GetMaxBandwidthMbpsForConnectionSubtype.
static double GetMaxBandwidthForConnectionSubtype(ConnectionSubtype subtype);
+ // Returns true if the platform supports use of API based on NetworkHandles.
pauljensen 2015/11/30 20:23:48 API->APIs
+ // Public methods that use NetworkHandles are GetNetworkConnectionType(),
+ // GetNetworkConnectionType(), and GetDefaultNetwork().
pauljensen 2015/11/30 20:23:48 please also mention NetworkObserver
Jana 2015/11/30 22:31:06 Done.
+ static bool AreNetworkHandlesSupported();
+
// Sets |network_list| to a list of all networks that are currently connected.
// Only implemented for Android (Lollipop and newer), leaves |network_list|
- // empty when unimplemented.
+ // empty when unimplemented. Requires NetworkHandles support.
pauljensen 2015/11/30 20:23:48 support->support, see AreNetworkHandlesSupported()
Jana 2015/11/30 22:31:06 Done.
static void GetConnectedNetworks(NetworkList* network_list);
// Returns the type of connection |network| uses. Note that this may vary
// slightly over time (e.g. CONNECTION_2G to CONNECTION_3G). If |network|
// is no longer connected, it will return CONNECTION_UNKNOWN.
// Only implemented for Android (Lollipop and newer), returns
- // CONNECTION_UNKNOWN when unimplemented.
+ // CONNECTION_UNKNOWN when unimplemented. Requires NetworkHandles support.
pauljensen 2015/11/30 20:23:48 ditto
Jana 2015/11/30 22:31:06 Done.
static ConnectionType GetNetworkConnectionType(NetworkHandle network);
// Returns the device's current default network connection. This is the
@@ -310,6 +315,7 @@ class NET_EXPORT NetworkChangeNotifier {
// there is no default connected network.
// Only implemented for Android (Lollipop and newer), returns
// |kInvalidNetworkHandle| when unimplemented.
+ // Requires NetworkHandles support.
pauljensen 2015/11/30 20:23:48 ditto
Jana 2015/11/30 22:31:06 Done.
static NetworkHandle GetDefaultNetwork();
// Retrieve the last read DnsConfig. This could be expensive if the system has
@@ -481,6 +487,7 @@ class NET_EXPORT NetworkChangeNotifier {
virtual void GetCurrentMaxBandwidthAndConnectionType(
double* max_bandwidth_mbps,
ConnectionType* connection_type) const;
+ virtual bool AreNetworkHandlesCurrentlySupported() const;
virtual void GetCurrentConnectedNetworks(NetworkList* network_list) const;
virtual ConnectionType GetCurrentNetworkConnectionType(
NetworkHandle network) const;

Powered by Google App Engine
This is Rietveld 408576698