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

Unified Diff: net/base/network_interfaces_win.cc

Issue 1984133003: Remove Windows Vista/XP specific code from net/base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixing builds Created 4 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_interfaces_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/network_interfaces_win.cc
diff --git a/net/base/network_interfaces_win.cc b/net/base/network_interfaces_win.cc
index 45fce26f11da88265b8ac59e8b290d712a24c6eb..e2f53caab9f060cd55fb56190a4fad1b8ccdfa76 100644
--- a/net/base/network_interfaces_win.cc
+++ b/net/base/network_interfaces_win.cc
@@ -15,7 +15,6 @@
#include "base/strings/utf_string_conversions.h"
#include "base/threading/thread_restrictions.h"
#include "base/win/scoped_handle.h"
-#include "base/win/windows_version.h"
#include "net/base/escape.h"
#include "net/base/ip_endpoint.h"
#include "net/base/net_errors.h"
@@ -27,12 +26,6 @@ namespace {
// Converts Windows defined types to NetworkInterfaceType.
NetworkChangeNotifier::ConnectionType GetNetworkInterfaceType(DWORD ifType) {
- // Bail out for pre-Vista versions of Windows which are documented to give
- // inaccurate results like returning Ethernet for WiFi.
- // http://msdn.microsoft.com/en-us/library/windows/desktop/aa366058.aspx
- if (base::win::GetVersion() < base::win::VERSION_VISTA)
- return NetworkChangeNotifier::CONNECTION_UNKNOWN;
-
NetworkChangeNotifier::ConnectionType type =
NetworkChangeNotifier::CONNECTION_UNKNOWN;
if (ifType == IF_TYPE_ETHERNET_CSMACD) {
@@ -136,7 +129,6 @@ WlanApi::WlanApi() : initialized(false) {
bool GetNetworkListImpl(NetworkInterfaceList* networks,
int policy,
- bool is_xp,
const IP_ADAPTER_ADDRESSES* adapters) {
for (const IP_ADAPTER_ADDRESSES* adapter = adapters; adapter != NULL;
adapter = adapter->Next) {
@@ -165,29 +157,7 @@ bool GetNetworkListImpl(NetworkInterfaceList* networks,
IPEndPoint endpoint;
if (endpoint.FromSockAddr(address->Address.lpSockaddr,
address->Address.iSockaddrLength)) {
- // XP has no OnLinkPrefixLength field.
- size_t prefix_length = is_xp ? 0 : address->OnLinkPrefixLength;
- if (is_xp) {
- // Prior to Windows Vista the FirstPrefix pointed to the list with
- // single prefix for each IP address assigned to the adapter.
- // Order of FirstPrefix does not match order of FirstUnicastAddress,
- // so we need to find corresponding prefix.
- for (IP_ADAPTER_PREFIX* prefix = adapter->FirstPrefix; prefix;
- prefix = prefix->Next) {
- int prefix_family = prefix->Address.lpSockaddr->sa_family;
- IPEndPoint network_endpoint;
- if (prefix_family == family &&
- network_endpoint.FromSockAddr(
- prefix->Address.lpSockaddr,
- prefix->Address.iSockaddrLength) &&
- IPAddressMatchesPrefix(endpoint.address(),
- network_endpoint.address(),
- prefix->PrefixLength)) {
- prefix_length =
- std::max<size_t>(prefix_length, prefix->PrefixLength);
- }
- }
- }
+ size_t prefix_length = address->OnLinkPrefixLength;
// If the duplicate address detection (DAD) state is not changed to
// Preferred, skip this address.
@@ -227,9 +197,8 @@ bool GetNetworkListImpl(NetworkInterfaceList* networks,
} // namespace internal
bool GetNetworkList(NetworkInterfaceList* networks, int policy) {
- bool is_xp = base::win::GetVersion() < base::win::VERSION_VISTA;
ULONG len = 0;
- ULONG flags = is_xp ? GAA_FLAG_INCLUDE_PREFIX : 0;
+ ULONG flags = 0;
// GetAdaptersAddresses() may require IO operations.
base::ThreadRestrictions::AssertIOAllowed();
ULONG result = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, NULL, &len);
@@ -246,7 +215,7 @@ bool GetNetworkList(NetworkInterfaceList* networks, int policy) {
return false;
}
- return internal::GetNetworkListImpl(networks, policy, is_xp, adapters);
+ return internal::GetNetworkListImpl(networks, policy, adapters);
}
WifiPHYLayerProtocol GetWifiPHYLayerProtocol() {
« no previous file with comments | « net/base/network_interfaces_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698