| Index: components/wifi/wifi_service_win.cc
|
| diff --git a/components/wifi/wifi_service_win.cc b/components/wifi/wifi_service_win.cc
|
| index 812686841d6257dc46f8854ba7b34e7b37213eb8..50fb21f54b5a2b06cbe39d851f5d317995815e93 100644
|
| --- a/components/wifi/wifi_service_win.cc
|
| +++ b/components/wifi/wifi_service_win.cc
|
| @@ -226,6 +226,9 @@ class WiFiServiceImpl : public WiFiService {
|
|
|
| virtual void RequestConnectedNetworkUpdate() override {}
|
|
|
| + virtual void GetConnectedNetworkSSID(std::string* ssid,
|
| + std::string* error) override;
|
| +
|
| private:
|
| typedef int32 EncryptionType;
|
| enum EncryptionTypeEnum {
|
| @@ -357,6 +360,11 @@ class WiFiServiceImpl : public WiFiService {
|
| // by interface. Populate |current_properties| on success.
|
| DWORD GetCurrentProperties(NetworkProperties* current_properties);
|
|
|
| + // Get the SSID of the network currently used (connected or in transition)
|
| + // by interface. Populate |ssid| on success. This is a stripped down version
|
| + // of GetCurrentProperties that doesn't use the BSS list;
|
| + DWORD GetCurrentSSID(std::string* ssid);
|
| +
|
| // Connect to network |network_guid| using previosly stored profile if exists,
|
| // or just network sid. If |frequency| is not |kFrequencyUnknown| then
|
| // connects only to BSS which uses that frequency and returns
|
| @@ -806,6 +814,18 @@ void WiFiServiceImpl::SetEventObservers(
|
| }
|
| }
|
|
|
| +void WiFiServiceImpl::GetConnectedNetworkSSID(std::string* ssid,
|
| + std::string* error) {
|
| + DWORD error_code = EnsureInitialized();
|
| + if (CheckError(error_code, kErrorWiFiService, error))
|
| + return;
|
| + std::string current_ssid;
|
| + error_code = GetCurrentSSID(¤t_ssid);
|
| + if (CheckError(error_code, kErrorWiFiService, error))
|
| + return;
|
| + *ssid = current_ssid;
|
| +}
|
| +
|
| void WiFiServiceImpl::OnWlanNotificationCallback(
|
| PWLAN_NOTIFICATION_DATA wlan_notification_data,
|
| PVOID context) {
|
| @@ -1462,6 +1482,37 @@ DWORD WiFiServiceImpl::GetCurrentProperties(NetworkProperties* properties) {
|
| return error;
|
| }
|
|
|
| +
|
| +DWORD WiFiServiceImpl::GetCurrentSSID(std::string* ssid) {
|
| + if (client_ == NULL) {
|
| + NOTREACHED();
|
| + return ERROR_NOINTERFACE;
|
| + }
|
| + DWORD error = ERROR_SUCCESS;
|
| + DWORD data_size = 0;
|
| + PWLAN_CONNECTION_ATTRIBUTES wlan_connection_attributes = NULL;
|
| + error = WlanQueryInterface_function_(
|
| + client_,
|
| + &interface_guid_,
|
| + wlan_intf_opcode_current_connection,
|
| + NULL,
|
| + &data_size,
|
| + reinterpret_cast<PVOID*>(&wlan_connection_attributes),
|
| + NULL);
|
| + if (error == ERROR_SUCCESS &&
|
| + wlan_connection_attributes != NULL) {
|
| + WLAN_ASSOCIATION_ATTRIBUTES& connected_wlan =
|
| + wlan_connection_attributes->wlanAssociationAttributes;
|
| + *ssid = GUIDFromSSID(connected_wlan.dot11Ssid);
|
| + }
|
| +
|
| + // Clean up.
|
| + if (wlan_connection_attributes != NULL)
|
| + WlanFreeMemory_function_(wlan_connection_attributes);
|
| +
|
| + return error;
|
| +}
|
| +
|
| Frequency WiFiServiceImpl::GetFrequencyToConnect(
|
| const std::string& network_guid) const {
|
| // Check whether desired frequency is set in |connect_properties_|.
|
|
|