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

Unified Diff: net/base/network_change_notifier.cc

Issue 1454313002: Adding platform support check for NetworkObserver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@home
Patch Set: Added forcing networkhandle support to NCNAndroid and NCNAndroidTest Created 5 years 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/base/network_change_notifier.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/network_change_notifier.cc
diff --git a/net/base/network_change_notifier.cc b/net/base/network_change_notifier.cc
index fb480e9705f2c418b32ca57a2e80888fd9c20aa0..187923cc8969d06230b55d8166d2eb041665b8a0 100644
--- a/net/base/network_change_notifier.cc
+++ b/net/base/network_change_notifier.cc
@@ -634,7 +634,16 @@ double NetworkChangeNotifier::GetMaxBandwidthForConnectionSubtype(
}
// static
+bool NetworkChangeNotifier::AreNetworkHandlesSupported() {
+ if (g_network_change_notifier) {
+ return g_network_change_notifier->AreNetworkHandlesCurrentlySupported();
+ }
+ return false;
+}
+
+// static
void NetworkChangeNotifier::GetConnectedNetworks(NetworkList* network_list) {
+ DCHECK(AreNetworkHandlesSupported());
if (g_network_change_notifier) {
g_network_change_notifier->GetCurrentConnectedNetworks(network_list);
} else {
@@ -645,6 +654,7 @@ void NetworkChangeNotifier::GetConnectedNetworks(NetworkList* network_list) {
// static
NetworkChangeNotifier::ConnectionType
NetworkChangeNotifier::GetNetworkConnectionType(NetworkHandle network) {
+ DCHECK(AreNetworkHandlesSupported());
return g_network_change_notifier
? g_network_change_notifier->GetCurrentNetworkConnectionType(
network)
@@ -654,6 +664,7 @@ NetworkChangeNotifier::GetNetworkConnectionType(NetworkHandle network) {
// static
NetworkChangeNotifier::NetworkHandle
NetworkChangeNotifier::GetDefaultNetwork() {
+ DCHECK(AreNetworkHandlesSupported());
return g_network_change_notifier
? g_network_change_notifier->GetCurrentDefaultNetwork()
: kInvalidNetworkHandle;
@@ -838,6 +849,7 @@ void NetworkChangeNotifier::AddMaxBandwidthObserver(
}
void NetworkChangeNotifier::AddNetworkObserver(NetworkObserver* observer) {
+ DCHECK(AreNetworkHandlesSupported());
if (g_network_change_notifier) {
g_network_change_notifier->network_observer_list_->AddObserver(observer);
}
@@ -883,6 +895,7 @@ void NetworkChangeNotifier::RemoveMaxBandwidthObserver(
}
void NetworkChangeNotifier::RemoveNetworkObserver(NetworkObserver* observer) {
+ DCHECK(AreNetworkHandlesSupported());
if (g_network_change_notifier) {
g_network_change_notifier->network_observer_list_->RemoveObserver(observer);
}
@@ -978,6 +991,10 @@ void NetworkChangeNotifier::GetCurrentMaxBandwidthAndConnectionType(
: GetMaxBandwidthForConnectionSubtype(SUBTYPE_UNKNOWN);
}
+bool NetworkChangeNotifier::AreNetworkHandlesCurrentlySupported() const {
+ return false;
+}
+
void NetworkChangeNotifier::GetCurrentConnectedNetworks(
NetworkList* network_list) const {
network_list->clear();
« no previous file with comments | « net/base/network_change_notifier.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698