Chromium Code Reviews| Index: chromeos/network/network_state_handler.cc |
| diff --git a/chromeos/network/network_state_handler.cc b/chromeos/network/network_state_handler.cc |
| index 2ba68620e0c2b8b5d69b4918b7c68e68724d1b3d..7fa5aab74c0b030a17d505c5c81e50b1c5e30c1c 100644 |
| --- a/chromeos/network/network_state_handler.cc |
| +++ b/chromeos/network/network_state_handler.cc |
| @@ -594,13 +594,51 @@ bool NetworkStateHandler::RemoveTetherNetworkState(const std::string& guid) { |
| tether_network_list_.erase(iter); |
| NotifyNetworkListChanged(); |
| + |
| return true; |
| } |
| } |
| - |
| return false; |
| } |
| +bool NetworkStateHandler::DisassociateTetherNetworkStateFromWifiNetwork( |
| + const std::string& tether_network_guid, |
| + const std::string& wifi_network_guid) { |
|
stevenjb
2017/05/03 23:02:21
We shouldn't need wifi_network_guid here? This sho
lesliewatkins
2017/05/04 01:40:16
I didn't do the DCHECK part because I'm not exactl
|
| + bool success = true; |
| + bool tether_network_changed = false; |
| + bool wifi_network_changed = false; |
| + |
| + NetworkState* tether_network = |
| + GetModifiableNetworkStateFromGuid(tether_network_guid); |
| + NetworkState* wifi_network = |
| + GetModifiableNetworkStateFromGuid(wifi_network_guid); |
| + |
| + if (!tether_network) { |
| + NET_LOG(ERROR) << "DisassociateTetherNetworkStateWithWifiNetwork(): Tether " |
| + << "network with ID " << tether_network_guid |
|
Kyle Horimoto
2017/05/03 22:47:28
super nit: I usually append a << " " at the end of
lesliewatkins
2017/05/04 01:40:16
Done.
|
| + << " not registered; could not remove association."; |
| + success = false; |
| + } else { |
| + tether_network->set_tether_guid(std::string()); |
| + tether_network_changed = true; |
| + } |
| + |
| + if (!wifi_network) { |
| + NET_LOG(ERROR) << "DisassociateTetherNetworkStateWithWifiNetwork(): Wi-Fi " |
| + << "network with ID " << wifi_network_guid |
| + << " not registered; could not remove association."; |
| + success = false; |
| + } else { |
| + wifi_network->set_tether_guid(std::string()); |
| + wifi_network_changed = true; |
| + } |
| + |
| + if (tether_network_changed || wifi_network_changed) |
| + NotifyNetworkListChanged(); |
| + |
| + return success; |
|
Kyle Horimoto
2017/05/03 22:47:28
You no longer need a success boolean. Just return
lesliewatkins
2017/05/04 01:40:16
Done.
|
| +} |
| + |
| bool NetworkStateHandler::AssociateTetherNetworkStateWithWifiNetwork( |
| const std::string& tether_network_guid, |
| const std::string& wifi_network_guid) { |