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

Unified Diff: net/base/network_change_notifier_mac.cc

Issue 2896203003: [NetworkChangeNotifier] Return more specific network connection types (ethernet/wifi) on OSX (Closed)
Patch Set: Address issues from PS5 Created 3 years, 7 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
« no previous file with comments | « net/base/network_change_notifier_mac.h ('k') | net/base/network_change_notifier_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/network_change_notifier_mac.cc
diff --git a/net/base/network_change_notifier_mac.cc b/net/base/network_change_notifier_mac.cc
index 0082153613a1ef79c2c85c9c8081759fb20336d1..dc6430f1aa69a4e3f86d9958125f2f54029389bb 100644
--- a/net/base/network_change_notifier_mac.cc
+++ b/net/base/network_change_notifier_mac.cc
@@ -21,24 +21,6 @@ static bool CalculateReachability(SCNetworkConnectionFlags flags) {
return reachable && !connection_required;
}
-NetworkChangeNotifier::ConnectionType CalculateConnectionType(
- SCNetworkConnectionFlags flags) {
- bool reachable = CalculateReachability(flags);
- if (reachable) {
-#if defined(OS_IOS)
- return (flags & kSCNetworkReachabilityFlagsIsWWAN) ?
- NetworkChangeNotifier::CONNECTION_3G :
- NetworkChangeNotifier::CONNECTION_WIFI;
-#else
- // TODO(droger): Get something more detailed than CONNECTION_UNKNOWN.
- // http://crbug.com/112937
- return NetworkChangeNotifier::CONNECTION_UNKNOWN;
-#endif // defined(OS_IOS)
- } else {
- return NetworkChangeNotifier::CONNECTION_NONE;
- }
-}
-
// Thread on which we can run DnsConfigService, which requires a TYPE_IO
// message loop.
class NetworkChangeNotifierMac::DnsConfigServiceThread : public base::Thread {
@@ -117,6 +99,23 @@ void NetworkChangeNotifierMac::Forwarder::Init() {
net_config_watcher_->SetInitialConnectionType();
}
+// static
+NetworkChangeNotifier::ConnectionType
+NetworkChangeNotifierMac::CalculateConnectionType(
+ SCNetworkConnectionFlags flags) {
+ bool reachable = CalculateReachability(flags);
+ if (reachable) {
+#if defined(OS_IOS)
+ return (flags & kSCNetworkReachabilityFlagsIsWWAN) ? CONNECTION_3G
+ : CONNECTION_WIFI;
+#else
+ return ConnectionTypeFromInterfaces();
+#endif // defined(OS_IOS)
+ } else {
+ return CONNECTION_NONE;
+ }
+}
+
void NetworkChangeNotifierMac::Forwarder::StartReachabilityNotifications() {
net_config_watcher_->StartReachabilityNotifications();
}
« no previous file with comments | « net/base/network_change_notifier_mac.h ('k') | net/base/network_change_notifier_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698