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

Unified Diff: chromeos/network/network_device_handler_impl.cc

Issue 2040603002: Add support for MAC address randomization (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix FakeNetworkDeviceHandler in unit tests Created 4 years, 6 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 | « chromeos/network/network_device_handler_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
+ 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 =
« no previous file with comments | « chromeos/network/network_device_handler_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698