Commit 603d50ee authored by Steven Bennetts's avatar Steven Bennetts Committed by Commit Bot

Cleanup NetworkConfigurationHandler::SetManagerProperty

When this was added, there was discussion around providing policy
controls around the AlwaysOnVpnLockdown network property, which was
why we added a wrapper in MNCH.

Since that never materialized, and since the one caller does not
implement either callback in release, this CL removes the MNCH
wrapper and removes the callbacks from the API to simplify it.

For DVLOG removal in components/arc/net:
TBR=hugobenichi@chromium.org

Bug: 1054441
Change-Id: Ib9581f22d4ed7f028694ef02db08294cf5ef014a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2287388Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarMustaq Ahmed <mustaq@chromium.org>
Reviewed-by: default avatarPavol Marko <pmarko@chromium.org>
Reviewed-by: default avatarPhilipp Weiß <phweiss@chromium.org>
Commit-Queue: Steven Bennetts <stevenjb@chromium.org>
Auto-Submit: Steven Bennetts <stevenjb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#788671}
parent 5986a0e0
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
namespace base { namespace base {
class DictionaryValue; class DictionaryValue;
class ListValue; class ListValue;
class Value;
} // namespace base } // namespace base
namespace chromeos { namespace chromeos {
...@@ -96,12 +95,6 @@ class COMPONENT_EXPORT(CHROMEOS_NETWORK) ManagedNetworkConfigurationHandler { ...@@ -96,12 +95,6 @@ class COMPONENT_EXPORT(CHROMEOS_NETWORK) ManagedNetworkConfigurationHandler {
const base::Closure& callback, const base::Closure& callback,
const network_handler::ErrorCallback& error_callback) = 0; const network_handler::ErrorCallback& error_callback) = 0;
virtual void SetManagerProperty(
const std::string& property_name,
const base::Value& value,
const base::Closure& callback,
const network_handler::ErrorCallback& error_callback) = 0;
// Initially configures an unconfigured network with the given user settings // Initially configures an unconfigured network with the given user settings
// and returns the new identifier to |callback| if successful. Fails if the // and returns the new identifier to |callback| if successful. Fails if the
// network was already configured by a call to this function or because of a // network was already configured by a call to this function or because of a
......
...@@ -303,15 +303,6 @@ void ManagedNetworkConfigurationHandlerImpl::SetProperties( ...@@ -303,15 +303,6 @@ void ManagedNetworkConfigurationHandlerImpl::SetProperties(
error_callback); error_callback);
} }
void ManagedNetworkConfigurationHandlerImpl::SetManagerProperty(
const std::string& property_name,
const base::Value& value,
const base::Closure& callback,
const network_handler::ErrorCallback& error_callback) {
network_configuration_handler_->SetManagerProperty(property_name, value,
callback, error_callback);
}
void ManagedNetworkConfigurationHandlerImpl::SetManagedActiveProxyValues( void ManagedNetworkConfigurationHandlerImpl::SetManagedActiveProxyValues(
const std::string& guid, const std::string& guid,
base::DictionaryValue* dictionary) { base::DictionaryValue* dictionary) {
......
...@@ -60,12 +60,6 @@ class COMPONENT_EXPORT(CHROMEOS_NETWORK) ManagedNetworkConfigurationHandlerImpl ...@@ -60,12 +60,6 @@ class COMPONENT_EXPORT(CHROMEOS_NETWORK) ManagedNetworkConfigurationHandlerImpl
const base::Closure& callback, const base::Closure& callback,
const network_handler::ErrorCallback& error_callback) override; const network_handler::ErrorCallback& error_callback) override;
void SetManagerProperty(
const std::string& property_name,
const base::Value& value,
const base::Closure& callback,
const network_handler::ErrorCallback& error_callback) override;
void CreateConfiguration( void CreateConfiguration(
const std::string& userhash, const std::string& userhash,
const base::DictionaryValue& properties, const base::DictionaryValue& properties,
......
...@@ -39,11 +39,6 @@ class COMPONENT_EXPORT(CHROMEOS_NETWORK) MockManagedNetworkConfigurationHandler ...@@ -39,11 +39,6 @@ class COMPONENT_EXPORT(CHROMEOS_NETWORK) MockManagedNetworkConfigurationHandler
const base::DictionaryValue& user_settings, const base::DictionaryValue& user_settings,
const base::Closure& callback, const base::Closure& callback,
const network_handler::ErrorCallback& error_callback)); const network_handler::ErrorCallback& error_callback));
MOCK_METHOD4(SetManagerProperty,
void(const std::string& property_name,
const base::Value& value,
const base::Closure& callback,
const network_handler::ErrorCallback& error_callback));
MOCK_CONST_METHOD4( MOCK_CONST_METHOD4(
CreateConfiguration, CreateConfiguration,
void(const std::string& userhash, void(const std::string& userhash,
......
...@@ -64,12 +64,11 @@ void SetNetworkProfileErrorCallback( ...@@ -64,12 +64,11 @@ void SetNetworkProfileErrorCallback(
} }
void ManagerSetPropertiesErrorCallback( void ManagerSetPropertiesErrorCallback(
const network_handler::ErrorCallback& error_callback,
const std::string& dbus_error_name, const std::string& dbus_error_name,
const std::string& dbus_error_message) { const std::string& dbus_error_message) {
network_handler::ShillErrorCallbackFunction( network_handler::ShillErrorCallbackFunction(
"ShillManagerClient.SetProperties Failed", std::string(), error_callback, "ShillManagerClient.SetProperties Failed", std::string(),
dbus_error_name, dbus_error_message); base::NullCallback(), dbus_error_name, dbus_error_message);
} }
void LogConfigProperties(const std::string& desc, void LogConfigProperties(const std::string& desc,
...@@ -451,13 +450,11 @@ void NetworkConfigurationHandler::SetNetworkProfile( ...@@ -451,13 +450,11 @@ void NetworkConfigurationHandler::SetNetworkProfile(
void NetworkConfigurationHandler::SetManagerProperty( void NetworkConfigurationHandler::SetManagerProperty(
const std::string& property_name, const std::string& property_name,
const base::Value& value, const base::Value& value) {
const base::Closure& callback,
const network_handler::ErrorCallback& error_callback) {
NET_LOG(USER) << "SetManagerProperty: " << property_name << ": " << value; NET_LOG(USER) << "SetManagerProperty: " << property_name << ": " << value;
ShillManagerClient::Get()->SetProperty( ShillManagerClient::Get()->SetProperty(
property_name, value, callback, property_name, value, base::DoNothing(),
base::BindOnce(&ManagerSetPropertiesErrorCallback, error_callback)); base::BindOnce(&ManagerSetPropertiesErrorCallback));
} }
// NetworkStateHandlerObserver methods // NetworkStateHandlerObserver methods
......
...@@ -121,9 +121,7 @@ class COMPONENT_EXPORT(CHROMEOS_NETWORK) NetworkConfigurationHandler ...@@ -121,9 +121,7 @@ class COMPONENT_EXPORT(CHROMEOS_NETWORK) NetworkConfigurationHandler
// Changes the value of a shill manager property. // Changes the value of a shill manager property.
void SetManagerProperty(const std::string& property_name, void SetManagerProperty(const std::string& property_name,
const base::Value& value, const base::Value& value);
const base::Closure& callback,
const network_handler::ErrorCallback& error_callback);
// NetworkStateHandlerObserver // NetworkStateHandlerObserver
void NetworkListChanged() override; void NetworkListChanged() override;
......
...@@ -758,8 +758,7 @@ TEST_F(NetworkConfigurationHandlerTest, AlwaysOnVpn) { ...@@ -758,8 +758,7 @@ TEST_F(NetworkConfigurationHandlerTest, AlwaysOnVpn) {
const std::string vpn_package = "com.android.vpn"; const std::string vpn_package = "com.android.vpn";
network_configuration_handler_->SetManagerProperty( network_configuration_handler_->SetManagerProperty(
shill::kAlwaysOnVpnPackageProperty, base::Value(vpn_package), shill::kAlwaysOnVpnPackageProperty, base::Value(vpn_package));
base::DoNothing(), base::Bind(&ErrorCallback));
ShillManagerClient::Get()->GetProperties( ShillManagerClient::Get()->GetProperties(
BindOnce(&NetworkConfigurationHandlerTest::ManagerGetPropertiesCallback, BindOnce(&NetworkConfigurationHandlerTest::ManagerGetPropertiesCallback,
......
...@@ -10,22 +10,11 @@ ...@@ -10,22 +10,11 @@
#include "base/bind_helpers.h" #include "base/bind_helpers.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/values.h" #include "base/values.h"
#include "chromeos/network/managed_network_configuration_handler.h" #include "chromeos/network/network_configuration_handler.h"
#include "chromeos/network/network_handler.h" #include "chromeos/network/network_handler.h"
#include "components/arc/arc_prefs.h" #include "components/arc/arc_prefs.h"
#include "third_party/cros_system_api/dbus/service_constants.h" #include "third_party/cros_system_api/dbus/service_constants.h"
namespace {
void SetPackageErrorCallback(
const std::string& error_name,
std::unique_ptr<base::DictionaryValue> error_data) {
DVLOG(1) << "Error while setting Always-On VPN package in shill: "
<< error_name << ", " << *error_data;
}
} // namespace
namespace arc { namespace arc {
AlwaysOnVpnManager::AlwaysOnVpnManager(PrefService* pref_service) { AlwaysOnVpnManager::AlwaysOnVpnManager(PrefService* pref_service) {
...@@ -46,10 +35,9 @@ AlwaysOnVpnManager::~AlwaysOnVpnManager() { ...@@ -46,10 +35,9 @@ AlwaysOnVpnManager::~AlwaysOnVpnManager() {
bool lockdown = registrar_.prefs()->GetBoolean(prefs::kAlwaysOnVpnLockdown); bool lockdown = registrar_.prefs()->GetBoolean(prefs::kAlwaysOnVpnLockdown);
if (lockdown && !package.empty()) { if (lockdown && !package.empty()) {
chromeos::NetworkHandler::Get() chromeos::NetworkHandler::Get()
->managed_network_configuration_handler() ->network_configuration_handler()
->SetManagerProperty(shill::kAlwaysOnVpnPackageProperty, ->SetManagerProperty(shill::kAlwaysOnVpnPackageProperty,
base::Value(std::string()), base::DoNothing(), base::Value(std::string()));
base::Bind(&SetPackageErrorCallback));
} }
registrar_.RemoveAll(); registrar_.RemoveAll();
} }
...@@ -63,11 +51,9 @@ void AlwaysOnVpnManager::OnPrefChanged() { ...@@ -63,11 +51,9 @@ void AlwaysOnVpnManager::OnPrefChanged() {
registrar_.prefs()->GetString(prefs::kAlwaysOnVpnPackage); registrar_.prefs()->GetString(prefs::kAlwaysOnVpnPackage);
} }
chromeos::NetworkHandler::Get() chromeos::NetworkHandler::Get()
->managed_network_configuration_handler() ->network_configuration_handler()
->SetManagerProperty(shill::kAlwaysOnVpnPackageProperty, ->SetManagerProperty(shill::kAlwaysOnVpnPackageProperty,
base::Value(always_on_vpn_package), base::Value(always_on_vpn_package));
base::DoNothing(),
base::Bind(&SetPackageErrorCallback));
} }
} // namespace arc } // namespace arc
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment