Chromium Code Reviews| Index: chromeos/components/tether/tether_network_disconnection_handler.cc |
| diff --git a/chromeos/components/tether/tether_network_disconnection_handler.cc b/chromeos/components/tether/tether_network_disconnection_handler.cc |
| index 71d273db788d2ba6ad697a80cc67b253a15becf4..3f41b1ff8f82d7a7219bdf4e1a1b58679dd8687d 100644 |
| --- a/chromeos/components/tether/tether_network_disconnection_handler.cc |
| +++ b/chromeos/components/tether/tether_network_disconnection_handler.cc |
| @@ -4,26 +4,42 @@ |
| #include "chromeos/components/tether/tether_network_disconnection_handler.h" |
| +#include "base/bind.h" |
| +#include "base/bind_helpers.h" |
| +#include "base/macros.h" |
| #include "base/memory/ptr_util.h" |
| +#include "chromeos/network/managed_network_configuration_handler.h" |
| #include "chromeos/network/network_handler.h" |
| #include "chromeos/network/network_state.h" |
| #include "chromeos/network/network_state_handler.h" |
| #include "components/proximity_auth/logging/logging.h" |
| +namespace { |
| + |
| +void RemoveConfigurationSuccessCallback() { |
| + PA_LOG(INFO) << "Successfully removed Wi-Fi network."; |
|
Kyle Horimoto
2017/04/17 20:34:53
Add more information to this log. Since the callba
Ryan Hansberry
2017/04/20 20:57:58
Done.
|
| +} |
| + |
| +void RemoveConfigurationFailureCallback( |
| + const std::string& error_name, |
| + std::unique_ptr<base::DictionaryValue> error_data) { |
| + PA_LOG(WARNING) << "Failed to remove Wi-Fi network: " << error_name; |
| +} |
| + |
| +} // namespace |
| + |
| namespace chromeos { |
| namespace tether { |
| TetherNetworkDisconnectionHandler::TetherNetworkDisconnectionHandler( |
| - ActiveHost* active_host) |
| - : TetherNetworkDisconnectionHandler( |
| - active_host, |
| - NetworkHandler::Get()->network_state_handler()) {} |
| - |
| -TetherNetworkDisconnectionHandler::TetherNetworkDisconnectionHandler( |
| ActiveHost* active_host, |
| - NetworkStateHandler* network_state_handler) |
| - : active_host_(active_host), network_state_handler_(network_state_handler) { |
| + NetworkStateHandler* network_state_handler, |
| + ManagedNetworkConfigurationHandler* managed_network_configuration_handler) |
| + : active_host_(active_host), |
| + network_state_handler_(network_state_handler), |
| + managed_network_configuration_handler_( |
| + managed_network_configuration_handler) { |
| network_state_handler_->AddObserver(this, FROM_HERE); |
| } |
| @@ -39,9 +55,12 @@ void TetherNetworkDisconnectionHandler::NetworkConnectionStateChanged( |
| !network->IsConnectedState()) { |
| PA_LOG(INFO) << "Connection to active host (Wi-Fi network GUID " |
| << network->guid() << ") has been lost."; |
| - active_host_->SetActiveHostDisconnected(); |
| - // TODO(hansberry): Remove Wi-Fi network from "known" networks. |
| + managed_network_configuration_handler_->RemoveConfiguration( |
|
Kyle Horimoto
2017/04/17 20:34:53
Can you actually move this functionality to a new
stevenjb
2017/04/18 21:03:36
Do we really want to remove the configuration on a
Kyle Horimoto
2017/04/18 21:14:00
Yes, we do want to remove the configuration on any
Ryan Hansberry
2017/04/20 20:57:57
Done.
|
| + network->path(), base::Bind(RemoveConfigurationSuccessCallback), |
| + base::Bind(RemoveConfigurationFailureCallback)); |
| + |
| + active_host_->SetActiveHostDisconnected(); |
| } |
| } |