OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/wifi/wifi_service.h" | 5 #include "components/wifi/wifi_service.h" |
6 | 6 |
7 #include <iphlpapi.h> | 7 #include <iphlpapi.h> |
8 #include <objbase.h> | 8 #include <objbase.h> |
9 #include <wlanapi.h> | 9 #include <wlanapi.h> |
10 | 10 |
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1070 properties->type = onc::network_type::kWiFi; | 1070 properties->type = onc::network_type::kWiFi; |
1071 | 1071 |
1072 for (size_t bss = 0; bss < wlan_bss_list.dwNumberOfItems; ++bss) { | 1072 for (size_t bss = 0; bss < wlan_bss_list.dwNumberOfItems; ++bss) { |
1073 const WLAN_BSS_ENTRY& bss_entry(wlan_bss_list.wlanBssEntries[bss]); | 1073 const WLAN_BSS_ENTRY& bss_entry(wlan_bss_list.wlanBssEntries[bss]); |
1074 if (bss_entry.dot11Ssid.uSSIDLength == wlan.dot11Ssid.uSSIDLength && | 1074 if (bss_entry.dot11Ssid.uSSIDLength == wlan.dot11Ssid.uSSIDLength && |
1075 0 == memcmp(bss_entry.dot11Ssid.ucSSID, | 1075 0 == memcmp(bss_entry.dot11Ssid.ucSSID, |
1076 wlan.dot11Ssid.ucSSID, | 1076 wlan.dot11Ssid.ucSSID, |
1077 bss_entry.dot11Ssid.uSSIDLength)) { | 1077 bss_entry.dot11Ssid.uSSIDLength)) { |
1078 properties->frequency = GetNormalizedFrequency( | 1078 properties->frequency = GetNormalizedFrequency( |
1079 bss_entry.ulChCenterFrequency / 1000); | 1079 bss_entry.ulChCenterFrequency / 1000); |
1080 properties->frequency_list.push_back(properties->frequency); | 1080 properties->frequency_set.insert(properties->frequency); |
1081 properties->bssid = NetworkProperties::MacAddressAsString( | 1081 properties->bssid = NetworkProperties::MacAddressAsString( |
1082 bss_entry.dot11Bssid); | 1082 bss_entry.dot11Bssid); |
1083 } | 1083 } |
1084 } | 1084 } |
1085 properties->frequency_list.sort(); | |
1086 properties->frequency_list.unique(); | |
1087 properties->security = | 1085 properties->security = |
1088 SecurityFromDot11AuthAlg(wlan.dot11DefaultAuthAlgorithm); | 1086 SecurityFromDot11AuthAlg(wlan.dot11DefaultAuthAlgorithm); |
1089 properties->signal_strength = wlan.wlanSignalQuality; | 1087 properties->signal_strength = wlan.wlanSignalQuality; |
1090 } | 1088 } |
1091 | 1089 |
1092 // Get the list of visible wireless networks | 1090 // Get the list of visible wireless networks |
1093 DWORD WiFiServiceImpl::GetVisibleNetworkList(NetworkList* network_list) { | 1091 DWORD WiFiServiceImpl::GetVisibleNetworkList(NetworkList* network_list) { |
1094 if (client_ == NULL) { | 1092 if (client_ == NULL) { |
1095 NOTREACHED(); | 1093 NOTREACHED(); |
1096 return ERROR_NOINTERFACE; | 1094 return ERROR_NOINTERFACE; |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1581 NetworkGuidList changed_networks(1, network_guid); | 1579 NetworkGuidList changed_networks(1, network_guid); |
1582 message_loop_proxy_->PostTask( | 1580 message_loop_proxy_->PostTask( |
1583 FROM_HERE, | 1581 FROM_HERE, |
1584 base::Bind(networks_changed_observer_, changed_networks)); | 1582 base::Bind(networks_changed_observer_, changed_networks)); |
1585 } | 1583 } |
1586 } | 1584 } |
1587 | 1585 |
1588 WiFiService* WiFiService::Create() { return new WiFiServiceImpl(); } | 1586 WiFiService* WiFiService::Create() { return new WiFiServiceImpl(); } |
1589 | 1587 |
1590 } // namespace wifi | 1588 } // namespace wifi |
OLD | NEW |