Chromium Code Reviews| Index: chromeos/network/network_device_handler_impl.cc |
| diff --git a/chromeos/network/network_device_handler_impl.cc b/chromeos/network/network_device_handler_impl.cc |
| index 59c1ddaf1f6babb92c43f73ff30fa1dd22c099a2..d1b1d05d633d019fcac723fa0767606a5af9c7ad 100644 |
| --- a/chromeos/network/network_device_handler_impl.cc |
| +++ b/chromeos/network/network_device_handler_impl.cc |
| @@ -432,6 +432,12 @@ void NetworkDeviceHandlerImpl::SetCellularAllowRoaming( |
| ApplyCellularAllowRoamingToShill(); |
| } |
| +void NetworkDeviceHandlerImpl::SetMACAddressRandomizationEnabled( |
| + const bool enabled) { |
|
stevenjb
2016/06/08 00:35:27
Can you add a log entry, e.g.:
NET_LOG(USER) << "D
|
| + mac_addr_randomization_ = enabled; |
| + ApplyMACAddressRandomizationToShill(); |
| +} |
| + |
| void NetworkDeviceHandlerImpl::SetWifiTDLSEnabled( |
| const std::string& ip_or_mac_address, |
| bool enabled, |
| @@ -520,11 +526,13 @@ void NetworkDeviceHandlerImpl::RemoveAllWifiWakeOnPacketConnections( |
| void NetworkDeviceHandlerImpl::DeviceListChanged() { |
| ApplyCellularAllowRoamingToShill(); |
| + ApplyMACAddressRandomizationToShill(); |
| } |
| NetworkDeviceHandlerImpl::NetworkDeviceHandlerImpl() |
| : network_state_handler_(NULL), |
| - cellular_allow_roaming_(false) {} |
| + cellular_allow_roaming_(false), |
| + mac_addr_randomization_(false) {} |
| void NetworkDeviceHandlerImpl::Init( |
| NetworkStateHandler* network_state_handler) { |
| @@ -564,6 +572,19 @@ void NetworkDeviceHandlerImpl::ApplyCellularAllowRoamingToShill() { |
| } |
| } |
| +void NetworkDeviceHandlerImpl::ApplyMACAddressRandomizationToShill() { |
| + const DeviceState* device_state = |
| + GetWifiDeviceState(network_handler::ErrorCallback()); |
| + if (!device_state) |
| + return; |
| + |
| + SetDevicePropertyInternal(device_state->path(), |
| + shill::kMACAddressRandomizationProperty, |
| + base::FundamentalValue(mac_addr_randomization_), |
| + base::Bind(&base::DoNothing), |
| + network_handler::ErrorCallback()); |
| +} |
| + |
| const DeviceState* NetworkDeviceHandlerImpl::GetWifiDeviceState( |
| const network_handler::ErrorCallback& error_callback) { |
| const DeviceState* device_state = |