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

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, 8 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 " << 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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698