OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chromeos/components/tether/network_configuration_remover.h" | |
6 | |
7 #include "base/bind.h" | |
8 #include "base/bind_helpers.h" | |
9 #include "base/macros.h" | |
10 #include "base/memory/ptr_util.h" | |
11 #include "chromeos/network/managed_network_configuration_handler.h" | |
12 #include "chromeos/network/network_handler.h" | |
13 #include "chromeos/network/network_state.h" | |
14 #include "components/proximity_auth/logging/logging.h" | |
15 | |
16 namespace { | |
17 | |
18 void RemoveConfigurationSuccessCallback(const std::string& guid) { | |
19 PA_LOG(INFO) << "Successfully removed Wi-Fi network " << guid << "."; | |
Kyle Horimoto
2017/04/21 01:05:11
nit: "network with GUID " << guid
Same below.
Ryan Hansberry
2017/04/24 17:58:23
Done.
| |
20 } | |
21 | |
22 void RemoveConfigurationFailureCallback( | |
23 const std::string& guid, | |
24 const std::string& error_name, | |
25 std::unique_ptr<base::DictionaryValue> error_data) { | |
26 PA_LOG(WARNING) << "Failed to remove Wi-Fi network " << guid | |
27 << ". Error:" << error_name << "."; | |
28 } | |
29 | |
30 } // namespace | |
31 | |
32 namespace chromeos { | |
33 | |
34 namespace tether { | |
35 | |
36 NetworkConfigurationRemover::NetworkConfigurationRemover( | |
37 NetworkStateHandler* network_state_handler, | |
38 ManagedNetworkConfigurationHandler* managed_network_configuration_handler) | |
39 : network_state_handler_(network_state_handler), | |
40 managed_network_configuration_handler_( | |
41 managed_network_configuration_handler) {} | |
42 | |
43 NetworkConfigurationRemover::~NetworkConfigurationRemover() {} | |
44 | |
45 void NetworkConfigurationRemover::RemoveNetworkConfiguration( | |
46 const std::string& wifi_network_guid) { | |
47 managed_network_configuration_handler_->RemoveConfiguration( | |
48 network_state_handler_->GetNetworkStateFromGuid(wifi_network_guid) | |
49 ->path(), | |
50 base::Bind(RemoveConfigurationSuccessCallback, wifi_network_guid), | |
51 base::Bind(RemoveConfigurationFailureCallback, wifi_network_guid)); | |
52 } | |
53 | |
54 } // namespace tether | |
55 | |
56 } // namespace chromeos | |
OLD | NEW |