| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/base/network_change_notifier_win.h" | 5 #include "net/base/network_change_notifier_win.h" |
| 6 | 6 |
| 7 #include <iphlpapi.h> | 7 #include <iphlpapi.h> |
| 8 #include <winsock2.h> | 8 #include <winsock2.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 LOG_IF(ERROR, result != 0) | 201 LOG_IF(ERROR, result != 0) |
| 202 << "WSALookupServiceEnd() failed with: " << result; | 202 << "WSALookupServiceEnd() failed with: " << result; |
| 203 | 203 |
| 204 // TODO(droger): Return something more detailed than CONNECTION_UNKNOWN. | 204 // TODO(droger): Return something more detailed than CONNECTION_UNKNOWN. |
| 205 return found_connection ? NetworkChangeNotifier::CONNECTION_UNKNOWN : | 205 return found_connection ? NetworkChangeNotifier::CONNECTION_UNKNOWN : |
| 206 NetworkChangeNotifier::CONNECTION_NONE; | 206 NetworkChangeNotifier::CONNECTION_NONE; |
| 207 } | 207 } |
| 208 | 208 |
| 209 NetworkChangeNotifier::ConnectionType | 209 NetworkChangeNotifier::ConnectionType |
| 210 NetworkChangeNotifierWin::GetCurrentConnectionType() const { | 210 NetworkChangeNotifierWin::GetCurrentConnectionType() const { |
| 211 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. |
| 212 tracked_objects::ScopedTracker tracking_profile( |
| 213 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 214 "422516 NetworkChangeNotifierWin::GetCurrentConnectionType")); |
| 215 |
| 211 base::AutoLock auto_lock(last_computed_connection_type_lock_); | 216 base::AutoLock auto_lock(last_computed_connection_type_lock_); |
| 212 return last_computed_connection_type_; | 217 return last_computed_connection_type_; |
| 213 } | 218 } |
| 214 | 219 |
| 215 void NetworkChangeNotifierWin::SetCurrentConnectionType( | 220 void NetworkChangeNotifierWin::SetCurrentConnectionType( |
| 216 ConnectionType connection_type) { | 221 ConnectionType connection_type) { |
| 217 base::AutoLock auto_lock(last_computed_connection_type_lock_); | 222 base::AutoLock auto_lock(last_computed_connection_type_lock_); |
| 218 last_computed_connection_type_ = connection_type; | 223 last_computed_connection_type_ = connection_type; |
| 219 } | 224 } |
| 220 | 225 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 return; | 329 return; |
| 325 } | 330 } |
| 326 if (last_announced_offline_) | 331 if (last_announced_offline_) |
| 327 UMA_HISTOGRAM_CUSTOM_COUNTS("NCN.OfflinePolls", offline_polls_, 1, 50, 50); | 332 UMA_HISTOGRAM_CUSTOM_COUNTS("NCN.OfflinePolls", offline_polls_, 1, 50, 50); |
| 328 last_announced_offline_ = current_offline; | 333 last_announced_offline_ = current_offline; |
| 329 | 334 |
| 330 NotifyObserversOfConnectionTypeChange(); | 335 NotifyObserversOfConnectionTypeChange(); |
| 331 } | 336 } |
| 332 | 337 |
| 333 } // namespace net | 338 } // namespace net |
| OLD | NEW |