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

Side by Side Diff: chromeos/components/tether/network_configuration_remover.cc

Issue 2821103003: Remove the configuration of Tether-associated Wi-Fi networks once connectivity is lost. (Closed)
Patch Set: Rebase. Created 3 years, 7 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 unified diff | Download patch
OLDNEW
(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 with GUID " << guid
20 << ".";
21 }
22
23 void RemoveConfigurationFailureCallback(
24 const std::string& guid,
25 const std::string& error_name,
26 std::unique_ptr<base::DictionaryValue> error_data) {
27 PA_LOG(WARNING) << "Failed to remove Wi-Fi network with GUID " << guid
28 << ". Error:" << error_name << ".";
29 }
30
31 } // namespace
32
33 namespace chromeos {
34
35 namespace tether {
36
37 NetworkConfigurationRemover::NetworkConfigurationRemover(
38 NetworkStateHandler* network_state_handler,
39 ManagedNetworkConfigurationHandler* managed_network_configuration_handler)
40 : network_state_handler_(network_state_handler),
41 managed_network_configuration_handler_(
42 managed_network_configuration_handler) {}
43
44 NetworkConfigurationRemover::~NetworkConfigurationRemover() {}
45
46 void NetworkConfigurationRemover::RemoveNetworkConfiguration(
47 const std::string& wifi_network_guid) {
48 managed_network_configuration_handler_->RemoveConfiguration(
49 network_state_handler_->GetNetworkStateFromGuid(wifi_network_guid)
50 ->path(),
51 base::Bind(RemoveConfigurationSuccessCallback, wifi_network_guid),
52 base::Bind(RemoveConfigurationFailureCallback, wifi_network_guid));
53 }
54
55 } // namespace tether
56
57 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698