Chromium Code Reviews| 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..d6e1f0b3927b2b0741ae4b8be40c2f9e630c30ab 100644 |
| --- a/net/base/network_change_notifier.cc |
| +++ b/net/base/network_change_notifier.cc |
| @@ -275,6 +275,34 @@ NetworkChangeNotifier::GetAddressTracker() { |
| #endif |
| // static |
| +bool NetworkChangeNotifier::IsOffline() { |
| + return GetConnectionType() == CONNECTION_NONE; |
| +} |
| + |
| +// static |
| +bool NetworkChangeNotifier::IsConnectionCellular() { |
| + return IsConnectionCellular(GetConnectionType()); |
| +} |
| + |
| +// static |
| +bool NetworkChangeNotifier::IsConnectionCellular(ConnectionType type) { |
| + switch (type) { |
| + case CONNECTION_2G: |
| + case CONNECTION_3G: |
| + case CONNECTION_4G: |
| + return true; |
| + case CONNECTION_UNKNOWN: |
| + case CONNECTION_ETHERNET: |
| + case CONNECTION_WIFI: |
| + case CONNECTION_NONE: |
| + return false; |
| + default: |
|
Ryan Sleevi
2012/10/12 17:49:57
If you remove this "default", you should get a com
|
| + NOTREACHED(); |
| + return false; |
| + } |
| +} |
| + |
| +// static |
| NetworkChangeNotifier* NetworkChangeNotifier::CreateMock() { |
| return new MockNetworkChangeNotifier(); |
| } |