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

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
« no previous file with comments | « net/android/network_change_notifier_android.cc ('k') | 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 4290331cddf259652a26253a3aa797a2fa69f011..e2af94b3e3301a8dd8f75da0ccc8da0b83baa32c 100644
--- a/net/base/network_change_notifier.h
+++ b/net/base/network_change_notifier.h
@@ -291,16 +291,24 @@ class NET_EXPORT NetworkChangeNotifier {
// TODO(jkarlin): Rename to GetMaxBandwidthMbpsForConnectionSubtype.
static double GetMaxBandwidthForConnectionSubtype(ConnectionSubtype subtype);
+ // Returns true if the platform supports use of APIs based on NetworkHandles.
+ // Public methods that use NetworkHandles are GetNetworkConnectionType(),
+ // GetNetworkConnectionType(), GetDefaultNetwork(), AddNetworkObserver(),
+ // RemoveNetworkObserver, and all public NetworkObserver methods.
pauljensen 2015/12/01 12:34:44 RemoveNetworkObserver->RemoveNetworkObserver()
+ 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, see
+ // AreNetworkHandlesSupported().
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,
+ // see AreNetworkHandlesSupported().
static ConnectionType GetNetworkConnectionType(NetworkHandle network);
// Returns the device's current default network connection. This is the
@@ -310,6 +318,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, see AreNetworkHandlesSupported().
static NetworkHandle GetDefaultNetwork();
// Retrieve the last read DnsConfig. This could be expensive if the system has
@@ -481,6 +490,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;
« no previous file with comments | « net/android/network_change_notifier_android.cc ('k') | net/base/network_change_notifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698