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

Unified Diff: net/base/network_change_notifier.cc

Issue 11115009: Helper functions in NetworkChangeNotifier related to WWAN use (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove whitespace Created 8 years, 2 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
« net/base/network_change_notifier.h ('K') | « 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 6b87a3a95cd9e18ec9d15743c3fc4206f626fa1d..95367faff3567d74c363ca67d215a477e06be21b 100644
--- a/net/base/network_change_notifier.cc
+++ b/net/base/network_change_notifier.cc
@@ -275,6 +275,30 @@ NetworkChangeNotifier::GetAddressTracker() {
#endif
// static
+bool NetworkChangeNotifier::IsOffline() {
+ return GetConnectionType() == CONNECTION_NONE;
+}
+
+// static
+bool NetworkChangeNotifier::IsConnectionCellular(ConnectionType type) {
+ bool is_cellular = false;
+ switch (type) {
+ case CONNECTION_2G:
+ case CONNECTION_3G:
+ case CONNECTION_4G:
+ is_cellular = true;
+ break;
+ case CONNECTION_UNKNOWN:
+ case CONNECTION_ETHERNET:
+ case CONNECTION_WIFI:
+ case CONNECTION_NONE:
+ is_cellular = false;
+ break;
+ }
+ return is_cellular;
+}
+
+// static
NetworkChangeNotifier* NetworkChangeNotifier::CreateMock() {
return new MockNetworkChangeNotifier();
}
« net/base/network_change_notifier.h ('K') | « net/base/network_change_notifier.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698