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

Side by Side Diff: net/base/network_change_notifier_win.cc

Issue 298023005: Infer network connection type from network interface type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Avoid std::vector operator[] element creation Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/base/network_change_notifier_unittest.cc ('k') | net/net.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 // There was nothing to iterate over! 193 // There was nothing to iterate over!
194 } else { 194 } else {
195 LOG(WARNING) << "WSALookupServiceNext() failed with:" << result; 195 LOG(WARNING) << "WSALookupServiceNext() failed with:" << result;
196 } 196 }
197 } 197 }
198 198
199 result = WSALookupServiceEnd(ws_handle); 199 result = WSALookupServiceEnd(ws_handle);
200 LOG_IF(ERROR, result != 0) 200 LOG_IF(ERROR, result != 0)
201 << "WSALookupServiceEnd() failed with: " << result; 201 << "WSALookupServiceEnd() failed with: " << result;
202 202
203 // TODO(droger): Return something more detailed than CONNECTION_UNKNOWN. 203 return found_connection ? ConnectionTypeFromInterfaces() :
204 return found_connection ? NetworkChangeNotifier::CONNECTION_UNKNOWN :
205 NetworkChangeNotifier::CONNECTION_NONE; 204 NetworkChangeNotifier::CONNECTION_NONE;
206 } 205 }
207 206
208 NetworkChangeNotifier::ConnectionType 207 NetworkChangeNotifier::ConnectionType
209 NetworkChangeNotifierWin::GetCurrentConnectionType() const { 208 NetworkChangeNotifierWin::GetCurrentConnectionType() const {
210 base::AutoLock auto_lock(last_computed_connection_type_lock_); 209 base::AutoLock auto_lock(last_computed_connection_type_lock_);
211 return last_computed_connection_type_; 210 return last_computed_connection_type_;
212 } 211 }
213 212
214 void NetworkChangeNotifierWin::SetCurrentConnectionType( 213 void NetworkChangeNotifierWin::SetCurrentConnectionType(
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 return; 317 return;
319 } 318 }
320 if (last_announced_offline_) 319 if (last_announced_offline_)
321 UMA_HISTOGRAM_CUSTOM_COUNTS("NCN.OfflinePolls", offline_polls_, 1, 50, 50); 320 UMA_HISTOGRAM_CUSTOM_COUNTS("NCN.OfflinePolls", offline_polls_, 1, 50, 50);
322 last_announced_offline_ = current_offline; 321 last_announced_offline_ = current_offline;
323 322
324 NotifyObserversOfConnectionTypeChange(); 323 NotifyObserversOfConnectionTypeChange();
325 } 324 }
326 325
327 } // namespace net 326 } // namespace net
OLDNEW
« no previous file with comments | « net/base/network_change_notifier_unittest.cc ('k') | net/net.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698