Chromium Code Reviews| 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 eccacaa6538b57c7e826e1e51161f4199313ff5e..dc40213ecb081160d3be83adefca0fd79f66f7e0 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'. |
|
wtc
2012/05/11 01:35:05
This whole comment block needs to be updated becau
|
| // |
| -bool NetworkChangeNotifierWin::IsCurrentlyOffline() const { |
| +NetworkChangeNotifier::ConnectionType |
| +NetworkChangeNotifierWin::GetCurrentConnectionType() 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::CONNECTION_NONE; |
|
wtc
2012/05/11 01:35:05
We should return NetworkChangeNotifier::CONNECTION
|
| } |
| 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::CONNECTION_ETHERNET : |
|
wtc
2012/05/11 01:35:05
Add a TODO comment here, because you're returning
|
| + NetworkChangeNotifier::CONNECTION_NONE; |
| } |
| void NetworkChangeNotifierWin::OnObjectSignaled(HANDLE object) { |
| @@ -172,14 +174,14 @@ void NetworkChangeNotifierWin::NotifyObservers() { |
| DCHECK(CalledOnValidThread()); |
| NotifyObserversOfIPAddressChange(); |
| - // Calling IsOffline() at this very moment is likely to give |
| + // Calling GetConnectionType() at this very moment is likely to give |
| // the wrong result, so we delay that until a little bit later. |
| // |
| // The one second delay chosen here was determined experimentally |
| // by adamk on Windows 7. |
| timer_.Stop(); // cancel any already waiting notification |
| timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(1), this, |
| - &NetworkChangeNotifierWin::NotifyParentOfOnlineStateChange); |
| + &NetworkChangeNotifierWin::NotifyParentOfConnectionTypeChange); |
| } |
| void NetworkChangeNotifierWin::WatchForAddressChange() { |
| @@ -235,8 +237,8 @@ bool NetworkChangeNotifierWin::WatchForAddressChangeInternal() { |
| return true; |
| } |
| -void NetworkChangeNotifierWin::NotifyParentOfOnlineStateChange() { |
| - NotifyObserversOfOnlineStateChange(); |
| +void NetworkChangeNotifierWin::NotifyParentOfConnectionTypeChange() { |
| + NotifyObserversOfConnectionTypeChange(); |
| } |
| } // namespace net |