Chromium Code Reviews| Index: chromeos/network/network_change_notifier_chromeos.cc |
| diff --git a/chromeos/network/network_change_notifier_chromeos.cc b/chromeos/network/network_change_notifier_chromeos.cc |
| index 5aa36b5bc809ce83f86eb86cf83f6779a5fd8c17..85332d1204e205e4b82104b1abb241c77bf090ba 100644 |
| --- a/chromeos/network/network_change_notifier_chromeos.cc |
| +++ b/chromeos/network/network_change_notifier_chromeos.cc |
| @@ -10,6 +10,7 @@ |
| #include "base/strings/stringprintf.h" |
| #include "chromeos/dbus/dbus_thread_manager.h" |
| #include "chromeos/network/network_change_notifier_chromeos.h" |
| +#include "chromeos/network/network_configuration_handler.h" |
| #include "chromeos/network/network_event_log.h" |
| #include "chromeos/network/network_state.h" |
| #include "chromeos/network/network_state_handler.h" |
| @@ -83,6 +84,16 @@ NetworkChangeNotifierChromeos::GetCurrentConnectionType() const { |
| return connection_type_; |
| } |
| +bool NetworkChangeNotifierChromeos::GetCurrentWifiApInfo( |
| + net::NetworkChangeNotifier::WifiApInfo &info) { |
| + if (connection_type_ != CONNECTION_WIFI) { |
| + return false; |
| + } |
|
stevenjb
2014/06/12 20:54:40
nit: {} unnecessary.
zqiu1
2014/07/07 23:37:33
Done.
|
| + |
| + info = wifi_ap_info_; |
| + return true; |
| +} |
| + |
| void NetworkChangeNotifierChromeos::SuspendDone( |
| const base::TimeDelta& sleep_duration) { |
| // Force invalidation of network resources on resume. |
| @@ -105,6 +116,52 @@ void NetworkChangeNotifierChromeos::DefaultNetworkChanged( |
| NetworkChangeNotifier::NotifyObserversOfIPAddressChange(); |
| if (dns_changed) |
| dns_config_service_->OnNetworkChange(); |
| + |
| + // Retrieve AP info for wifi connection. |
| + if (connection_type_ == CONNECTION_WIFI) { |
| + NetworkHandler::Get()->network_configuration_handler()->GetProperties( |
| + default_network->path(), |
| + base::Bind(&NetworkChangeNotifierChromeos::ParseWifiApInfo, |
| + AsWeakPtr()), |
| + base::Bind(&NetworkChangeNotifierChromeos::GetPropertiesFailedHandler, |
| + AsWeakPtr())); |
| + } |
| +} |
| + |
| +void NetworkChangeNotifierChromeos::ParseWifiApInfo( |
| + const std::string &service_path, |
| + const base::DictionaryValue& properties) { |
| + net::NetworkChangeNotifier::WifiApInfo info; |
| + properties.GetStringWithoutPathExpansion( |
| + shill::kWifiBSsid, &(info.bssid)); |
|
stevenjb
2014/06/12 20:54:40
nit: () after & unnecessary here and below
zqiu1
2014/07/07 23:37:33
Done.
|
| + properties.GetStringWithoutPathExpansion( |
| + shill::kSecurityProperty, &(info.security)); |
| + const base::DictionaryValue* vendor_dict = NULL; |
| + if (properties.GetDictionaryWithoutPathExpansion( |
| + shill::kWifiVendorInformationProperty, |
| + &vendor_dict)) { |
| + vendor_dict->GetStringWithoutPathExpansion( |
| + shill::kVendorWPSModelNumberProperty, |
| + &(info.model_number)); |
| + vendor_dict->GetStringWithoutPathExpansion( |
| + shill::kVendorWPSModelNameProperty, |
| + &(info.model_name)); |
| + vendor_dict->GetStringWithoutPathExpansion( |
| + shill::kVendorWPSDeviceNameProperty, |
| + &(info.device_name)); |
| + vendor_dict->GetStringWithoutPathExpansion( |
| + shill::kVendorWPSManufacturerProperty, |
| + &(info.manufacturer)); |
| + vendor_dict->GetStringWithoutPathExpansion(shill::kVendorOUIListProperty, |
| + &(info.oui_list)); |
| + } |
| + wifi_ap_info_ = info; |
| +} |
| + |
| +void NetworkChangeNotifierChromeos::GetPropertiesFailedHandler( |
| + const std::string& error_name, |
| + scoped_ptr<base::DictionaryValue> error_data) { |
| + // Nothing to be done, most likely the network service is already removed. |
|
stevenjb
2014/06/12 20:54:40
Since this is a noop you can just pass network_han
zqiu1
2014/07/07 23:37:32
Done.
|
| } |
| void NetworkChangeNotifierChromeos::UpdateState( |