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

Unified Diff: net/base/network_change_notifier_win.cc

Issue 9147026: API for connection type (Ethernet/WIFI/WWAN ...) in NetworkChangeNotifier. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 11 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
Index: net/base/network_change_notifier_win.cc
diff --git a/net/base/network_change_notifier_win.cc b/net/base/network_change_notifier_win.cc
index e1307447bc326ce2d2a47152175ab400f6cd7ee2..20a43b0192f27ff747117b406dd4f242a8240817 100644
--- a/net/base/network_change_notifier_win.cc
+++ b/net/base/network_change_notifier_win.cc
@@ -86,7 +86,8 @@ NetworkChangeNotifierWin::~NetworkChangeNotifierWin() {
// experiments I ran... However none of them correctly returned "offline" when
// executing 'ipconfig /release'.
//
-bool NetworkChangeNotifierWin::IsCurrentlyOffline() const {
+NetworkChangeNotifier::ConnectionState
+NetworkChangeNotifierWin::GetCurrentConnectionState() const {
// TODO(eroman): We could cache this value, and only re-calculate it on
// network changes. For now we recompute it each time asked,
@@ -109,7 +110,7 @@ bool NetworkChangeNotifierWin::IsCurrentlyOffline() const {
if (0 != WSALookupServiceBegin(&query_set, LUP_RETURN_ALL,
&ws_handle)) {
LOG(ERROR) << "WSALookupServiceBegin failed with: " << WSAGetLastError();
- return false;
+ return NetworkChangeNotifier::NONE;
}
bool found_connection = false;
@@ -154,7 +155,8 @@ bool NetworkChangeNotifierWin::IsCurrentlyOffline() const {
LOG_IF(ERROR, result != 0)
<< "WSALookupServiceEnd() failed with: " << result;
- return !found_connection;
+ return found_connection ? NetworkChangeNotifier::ETHERNET :
+ NetworkChangeNotifier::NONE;
}
void NetworkChangeNotifierWin::OnObjectSignaled(HANDLE object) {
@@ -179,7 +181,7 @@ void NetworkChangeNotifierWin::NotifyObservers() {
// by adamk on Windows 7.
timer_.Stop(); // cancel any already waiting notification
timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(1), this,
- &NetworkChangeNotifierWin::NotifyParentOfOnlineStateChange);
+ &NetworkChangeNotifierWin::NotifyParentOfConnectionStateChange);
}
void NetworkChangeNotifierWin::WatchForAddressChange() {
@@ -234,8 +236,8 @@ bool NetworkChangeNotifierWin::WatchForAddressChangeInternal() {
return true;
}
-void NetworkChangeNotifierWin::NotifyParentOfOnlineStateChange() {
- NotifyObserversOfOnlineStateChange();
+void NetworkChangeNotifierWin::NotifyParentOfConnectionStateChange() {
+ NotifyObserversOfConnectionStateChange();
}
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698