Commit 35fdb442 authored by Abhishek Bhardwaj's avatar Abhishek Bhardwaj Committed by Commit Bot

Clang format network related files

This change clang formats a subset of network related source files.

BUG=891143
TEST=Compile.

Change-Id: I131d132dbcd36200310a8c785eab067795e20576
Reviewed-on: https://chromium-review.googlesource.com/c/1252334
Commit-Queue: Abhishek Bhardwaj <abhishekbh@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595904}
parent 88a928b2
...@@ -39,8 +39,8 @@ const char kFailedMessage[] = "Failed"; ...@@ -39,8 +39,8 @@ const char kFailedMessage[] = "Failed";
void ErrorFunction(const std::string& device_path, void ErrorFunction(const std::string& device_path,
const std::string& error_name, const std::string& error_name,
const std::string& error_message) { const std::string& error_message) {
LOG(ERROR) << "Shill Error for: " << device_path LOG(ERROR) << "Shill Error for: " << device_path << ": " << error_name
<< ": " << error_name << " : " << error_message; << " : " << error_message;
} }
void PostError(const std::string& error, void PostError(const std::string& error,
...@@ -391,8 +391,10 @@ ShillDeviceClient::TestInterface* FakeShillDeviceClient::GetTestInterface() { ...@@ -391,8 +391,10 @@ ShillDeviceClient::TestInterface* FakeShillDeviceClient::GetTestInterface() {
void FakeShillDeviceClient::AddDevice(const std::string& device_path, void FakeShillDeviceClient::AddDevice(const std::string& device_path,
const std::string& type, const std::string& type,
const std::string& name) { const std::string& name) {
DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> DBusThreadManager::Get()
AddDevice(device_path); ->GetShillManagerClient()
->GetTestInterface()
->AddDevice(device_path);
base::Value* properties = GetDeviceProperties(device_path); base::Value* properties = GetDeviceProperties(device_path);
properties->SetKey(shill::kTypeProperty, base::Value(type)); properties->SetKey(shill::kTypeProperty, base::Value(type));
...@@ -407,15 +409,19 @@ void FakeShillDeviceClient::AddDevice(const std::string& device_path, ...@@ -407,15 +409,19 @@ void FakeShillDeviceClient::AddDevice(const std::string& device_path,
} }
void FakeShillDeviceClient::RemoveDevice(const std::string& device_path) { void FakeShillDeviceClient::RemoveDevice(const std::string& device_path) {
DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> DBusThreadManager::Get()
RemoveDevice(device_path); ->GetShillManagerClient()
->GetTestInterface()
->RemoveDevice(device_path);
stub_devices_.RemoveWithoutPathExpansion(device_path, NULL); stub_devices_.RemoveWithoutPathExpansion(device_path, NULL);
} }
void FakeShillDeviceClient::ClearDevices() { void FakeShillDeviceClient::ClearDevices() {
DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> DBusThreadManager::Get()
ClearDevices(); ->GetShillManagerClient()
->GetTestInterface()
->ClearDevices();
stub_devices_.Clear(); stub_devices_.Clear();
} }
...@@ -424,8 +430,8 @@ void FakeShillDeviceClient::SetDeviceProperty(const std::string& device_path, ...@@ -424,8 +430,8 @@ void FakeShillDeviceClient::SetDeviceProperty(const std::string& device_path,
const std::string& name, const std::string& name,
const base::Value& value, const base::Value& value,
bool notify_changed) { bool notify_changed) {
VLOG(1) << "SetDeviceProperty: " << device_path VLOG(1) << "SetDeviceProperty: " << device_path << ": " << name << " = "
<< ": " << name << " = " << value; << value;
SetPropertyInternal(dbus::ObjectPath(device_path), name, value, SetPropertyInternal(dbus::ObjectPath(device_path), name, value,
base::DoNothing(), base::DoNothing(),
base::Bind(&ErrorFunction, device_path), notify_changed); base::Bind(&ErrorFunction, device_path), notify_changed);
...@@ -433,14 +439,14 @@ void FakeShillDeviceClient::SetDeviceProperty(const std::string& device_path, ...@@ -433,14 +439,14 @@ void FakeShillDeviceClient::SetDeviceProperty(const std::string& device_path,
std::string FakeShillDeviceClient::GetDevicePathForType( std::string FakeShillDeviceClient::GetDevicePathForType(
const std::string& type) { const std::string& type) {
for (base::DictionaryValue::Iterator iter(stub_devices_); for (base::DictionaryValue::Iterator iter(stub_devices_); !iter.IsAtEnd();
!iter.IsAtEnd(); iter.Advance()) { iter.Advance()) {
const base::DictionaryValue* properties = NULL; const base::DictionaryValue* properties = NULL;
if (!iter.value().GetAsDictionary(&properties)) if (!iter.value().GetAsDictionary(&properties))
continue; continue;
std::string prop_type; std::string prop_type;
if (!properties->GetStringWithoutPathExpansion( if (!properties->GetStringWithoutPathExpansion(shill::kTypeProperty,
shill::kTypeProperty, &prop_type) || &prop_type) ||
prop_type != type) prop_type != type)
continue; continue;
return iter.key(); return iter.key();
...@@ -611,8 +617,8 @@ void FakeShillDeviceClient::PassStubDeviceProperties( ...@@ -611,8 +617,8 @@ void FakeShillDeviceClient::PassStubDeviceProperties(
const dbus::ObjectPath& device_path, const dbus::ObjectPath& device_path,
const DictionaryValueCallback& callback) const { const DictionaryValueCallback& callback) const {
const base::DictionaryValue* device_properties = NULL; const base::DictionaryValue* device_properties = NULL;
if (!stub_devices_.GetDictionaryWithoutPathExpansion( if (!stub_devices_.GetDictionaryWithoutPathExpansion(device_path.value(),
device_path.value(), &device_properties)) { &device_properties)) {
base::DictionaryValue empty_dictionary; base::DictionaryValue empty_dictionary;
callback.Run(DBUS_METHOD_CALL_FAILURE, empty_dictionary); callback.Run(DBUS_METHOD_CALL_FAILURE, empty_dictionary);
return; return;
...@@ -638,8 +644,7 @@ void FakeShillDeviceClient::NotifyObserversPropertyChanged( ...@@ -638,8 +644,7 @@ void FakeShillDeviceClient::NotifyObserversPropertyChanged(
} }
base::Value* value = NULL; base::Value* value = NULL;
if (!dict->GetWithoutPathExpansion(property, &value)) { if (!dict->GetWithoutPathExpansion(property, &value)) {
LOG(ERROR) << "Notify for unknown property: " LOG(ERROR) << "Notify for unknown property: " << path << " : " << property;
<< path << " : " << property;
return; return;
} }
for (auto& observer : GetObserverList(device_path)) for (auto& observer : GetObserverList(device_path))
......
...@@ -78,11 +78,10 @@ class CHROMEOS_EXPORT FakeShillDeviceClient ...@@ -78,11 +78,10 @@ class CHROMEOS_EXPORT FakeShillDeviceClient
const std::string& peer, const std::string& peer,
const StringCallback& callback, const StringCallback& callback,
const ErrorCallback& error_callback) override; const ErrorCallback& error_callback) override;
void AddWakeOnPacketConnection( void AddWakeOnPacketConnection(const dbus::ObjectPath& device_path,
const dbus::ObjectPath& device_path, const net::IPEndPoint& ip_endpoint,
const net::IPEndPoint& ip_endpoint, const base::Closure& callback,
const base::Closure& callback, const ErrorCallback& error_callback) override;
const ErrorCallback& error_callback) override;
void RemoveWakeOnPacketConnection( void RemoveWakeOnPacketConnection(
const dbus::ObjectPath& device_path, const dbus::ObjectPath& device_path,
const net::IPEndPoint& ip_endpoint, const net::IPEndPoint& ip_endpoint,
...@@ -165,7 +164,7 @@ class CHROMEOS_EXPORT FakeShillDeviceClient ...@@ -165,7 +164,7 @@ class CHROMEOS_EXPORT FakeShillDeviceClient
std::string tdls_state_; std::string tdls_state_;
// Wake on packet connections for each device. // Wake on packet connections for each device.
std::map<dbus::ObjectPath, std::set<net::IPEndPoint> > std::map<dbus::ObjectPath, std::set<net::IPEndPoint>>
wake_on_packet_connections_; wake_on_packet_connections_;
// Current SIM PIN per device path. // Current SIM PIN per device path.
......
...@@ -27,13 +27,11 @@ namespace { ...@@ -27,13 +27,11 @@ namespace {
// The ShillDeviceClient implementation. // The ShillDeviceClient implementation.
class ShillDeviceClientImpl : public ShillDeviceClient { class ShillDeviceClientImpl : public ShillDeviceClient {
public: public:
ShillDeviceClientImpl() ShillDeviceClientImpl() : bus_(NULL) {}
: bus_(NULL) {
}
~ShillDeviceClientImpl() override { ~ShillDeviceClientImpl() override {
for (HelperMap::iterator iter = helpers_.begin(); for (HelperMap::iterator iter = helpers_.begin(); iter != helpers_.end();
iter != helpers_.end(); ++iter) { ++iter) {
// This *should* never happen, yet we're getting crash reports that // This *should* never happen, yet we're getting crash reports that
// seem to imply that it does happen sometimes. Adding CHECKs here // seem to imply that it does happen sometimes. Adding CHECKs here
// so we can determine more accurately where the problem lies. // so we can determine more accurately where the problem lies.
...@@ -75,9 +73,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient { ...@@ -75,9 +73,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
dbus::MessageWriter writer(&method_call); dbus::MessageWriter writer(&method_call);
writer.AppendString(name); writer.AppendString(name);
ShillClientHelper::AppendValueDataAsVariant(&writer, value); ShillClientHelper::AppendValueDataAsVariant(&writer, value);
GetHelper(device_path)->CallVoidMethodWithErrorCallback(&method_call, GetHelper(device_path)
callback, ->CallVoidMethodWithErrorCallback(&method_call, callback,
error_callback); error_callback);
} }
void ClearProperty(const dbus::ObjectPath& device_path, void ClearProperty(const dbus::ObjectPath& device_path,
...@@ -100,8 +98,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient { ...@@ -100,8 +98,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
dbus::MessageWriter writer(&method_call); dbus::MessageWriter writer(&method_call);
writer.AppendString(pin); writer.AppendString(pin);
writer.AppendBool(require); writer.AppendBool(require);
GetHelper(device_path)->CallVoidMethodWithErrorCallback( GetHelper(device_path)
&method_call, callback, error_callback); ->CallVoidMethodWithErrorCallback(&method_call, callback,
error_callback);
} }
void EnterPin(const dbus::ObjectPath& device_path, void EnterPin(const dbus::ObjectPath& device_path,
...@@ -112,8 +111,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient { ...@@ -112,8 +111,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
shill::kEnterPinFunction); shill::kEnterPinFunction);
dbus::MessageWriter writer(&method_call); dbus::MessageWriter writer(&method_call);
writer.AppendString(pin); writer.AppendString(pin);
GetHelper(device_path)->CallVoidMethodWithErrorCallback( GetHelper(device_path)
&method_call, callback, error_callback); ->CallVoidMethodWithErrorCallback(&method_call, callback,
error_callback);
} }
void UnblockPin(const dbus::ObjectPath& device_path, void UnblockPin(const dbus::ObjectPath& device_path,
...@@ -126,8 +126,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient { ...@@ -126,8 +126,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
dbus::MessageWriter writer(&method_call); dbus::MessageWriter writer(&method_call);
writer.AppendString(puk); writer.AppendString(puk);
writer.AppendString(pin); writer.AppendString(pin);
GetHelper(device_path)->CallVoidMethodWithErrorCallback( GetHelper(device_path)
&method_call, callback, error_callback); ->CallVoidMethodWithErrorCallback(&method_call, callback,
error_callback);
} }
void ChangePin(const dbus::ObjectPath& device_path, void ChangePin(const dbus::ObjectPath& device_path,
...@@ -140,8 +141,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient { ...@@ -140,8 +141,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
dbus::MessageWriter writer(&method_call); dbus::MessageWriter writer(&method_call);
writer.AppendString(old_pin); writer.AppendString(old_pin);
writer.AppendString(new_pin); writer.AppendString(new_pin);
GetHelper(device_path)->CallVoidMethodWithErrorCallback( GetHelper(device_path)
&method_call, callback, error_callback); ->CallVoidMethodWithErrorCallback(&method_call, callback,
error_callback);
} }
void Register(const dbus::ObjectPath& device_path, void Register(const dbus::ObjectPath& device_path,
...@@ -152,8 +154,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient { ...@@ -152,8 +154,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
shill::kRegisterFunction); shill::kRegisterFunction);
dbus::MessageWriter writer(&method_call); dbus::MessageWriter writer(&method_call);
writer.AppendString(network_id); writer.AppendString(network_id);
GetHelper(device_path)->CallVoidMethodWithErrorCallback( GetHelper(device_path)
&method_call, callback, error_callback); ->CallVoidMethodWithErrorCallback(&method_call, callback,
error_callback);
} }
void SetCarrier(const dbus::ObjectPath& device_path, void SetCarrier(const dbus::ObjectPath& device_path,
...@@ -164,8 +167,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient { ...@@ -164,8 +167,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
shill::kSetCarrierFunction); shill::kSetCarrierFunction);
dbus::MessageWriter writer(&method_call); dbus::MessageWriter writer(&method_call);
writer.AppendString(carrier); writer.AppendString(carrier);
GetHelper(device_path)->CallVoidMethodWithErrorCallback( GetHelper(device_path)
&method_call, callback, error_callback); ->CallVoidMethodWithErrorCallback(&method_call, callback,
error_callback);
} }
void Reset(const dbus::ObjectPath& device_path, void Reset(const dbus::ObjectPath& device_path,
...@@ -173,8 +177,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient { ...@@ -173,8 +177,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
const ErrorCallback& error_callback) override { const ErrorCallback& error_callback) override {
dbus::MethodCall method_call(shill::kFlimflamDeviceInterface, dbus::MethodCall method_call(shill::kFlimflamDeviceInterface,
shill::kResetFunction); shill::kResetFunction);
GetHelper(device_path)->CallVoidMethodWithErrorCallback( GetHelper(device_path)
&method_call, callback, error_callback); ->CallVoidMethodWithErrorCallback(&method_call, callback,
error_callback);
} }
void PerformTDLSOperation(const dbus::ObjectPath& device_path, void PerformTDLSOperation(const dbus::ObjectPath& device_path,
...@@ -187,15 +192,15 @@ class ShillDeviceClientImpl : public ShillDeviceClient { ...@@ -187,15 +192,15 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
dbus::MessageWriter writer(&method_call); dbus::MessageWriter writer(&method_call);
writer.AppendString(operation); writer.AppendString(operation);
writer.AppendString(peer); writer.AppendString(peer);
GetHelper(device_path)->CallStringMethodWithErrorCallback( GetHelper(device_path)
&method_call, callback, error_callback); ->CallStringMethodWithErrorCallback(&method_call, callback,
error_callback);
} }
void AddWakeOnPacketConnection( void AddWakeOnPacketConnection(const dbus::ObjectPath& device_path,
const dbus::ObjectPath& device_path, const net::IPEndPoint& ip_endpoint,
const net::IPEndPoint& ip_endpoint, const base::Closure& callback,
const base::Closure& callback, const ErrorCallback& error_callback) override {
const ErrorCallback& error_callback) override {
if (ip_endpoint.address().empty()) { if (ip_endpoint.address().empty()) {
LOG(ERROR) << "AddWakeOnPacketConnection: null address"; LOG(ERROR) << "AddWakeOnPacketConnection: null address";
return; return;
...@@ -204,9 +209,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient { ...@@ -204,9 +209,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
shill::kAddWakeOnPacketConnectionFunction); shill::kAddWakeOnPacketConnectionFunction);
dbus::MessageWriter writer(&method_call); dbus::MessageWriter writer(&method_call);
writer.AppendString(ip_endpoint.ToStringWithoutPort()); writer.AppendString(ip_endpoint.ToStringWithoutPort());
GetHelper(device_path)->CallVoidMethodWithErrorCallback(&method_call, GetHelper(device_path)
callback, ->CallVoidMethodWithErrorCallback(&method_call, callback,
error_callback); error_callback);
} }
void RemoveWakeOnPacketConnection( void RemoveWakeOnPacketConnection(
...@@ -222,9 +227,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient { ...@@ -222,9 +227,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
shill::kRemoveWakeOnPacketConnectionFunction); shill::kRemoveWakeOnPacketConnectionFunction);
dbus::MessageWriter writer(&method_call); dbus::MessageWriter writer(&method_call);
writer.AppendString(ip_endpoint.ToStringWithoutPort()); writer.AppendString(ip_endpoint.ToStringWithoutPort());
GetHelper(device_path)->CallVoidMethodWithErrorCallback(&method_call, GetHelper(device_path)
callback, ->CallVoidMethodWithErrorCallback(&method_call, callback,
error_callback); error_callback);
} }
void RemoveAllWakeOnPacketConnections( void RemoveAllWakeOnPacketConnections(
...@@ -234,9 +239,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient { ...@@ -234,9 +239,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
dbus::MethodCall method_call( dbus::MethodCall method_call(
shill::kFlimflamDeviceInterface, shill::kFlimflamDeviceInterface,
shill::kRemoveAllWakeOnPacketConnectionsFunction); shill::kRemoveAllWakeOnPacketConnectionsFunction);
GetHelper(device_path)->CallVoidMethodWithErrorCallback(&method_call, GetHelper(device_path)
callback, ->CallVoidMethodWithErrorCallback(&method_call, callback,
error_callback); error_callback);
} }
TestInterface* GetTestInterface() override { return NULL; } TestInterface* GetTestInterface() override { return NULL; }
......
...@@ -61,11 +61,8 @@ void HandleShillCallFailure( ...@@ -61,11 +61,8 @@ void HandleShillCallFailure(
const std::string& shill_error_name, const std::string& shill_error_name,
const std::string& shill_error_message) { const std::string& shill_error_message) {
network_handler::ShillErrorCallbackFunction( network_handler::ShillErrorCallbackFunction(
GetErrorNameForShillError(shill_error_name), GetErrorNameForShillError(shill_error_name), device_path, error_callback,
device_path, shill_error_name, shill_error_message);
error_callback,
shill_error_name,
shill_error_message);
} }
void IPConfigRefreshCallback(const std::string& ipconfig_path, bool result) { void IPConfigRefreshCallback(const std::string& ipconfig_path, bool result) {
...@@ -82,12 +79,10 @@ void RefreshIPConfigsCallback( ...@@ -82,12 +79,10 @@ void RefreshIPConfigsCallback(
const std::string& device_path, const std::string& device_path,
const base::DictionaryValue& properties) { const base::DictionaryValue& properties) {
const base::ListValue* ip_configs; const base::ListValue* ip_configs;
if (!properties.GetListWithoutPathExpansion( if (!properties.GetListWithoutPathExpansion(shill::kIPConfigsProperty,
shill::kIPConfigsProperty, &ip_configs)) { &ip_configs)) {
network_handler::ShillErrorCallbackFunction( network_handler::ShillErrorCallbackFunction(
"RequestRefreshIPConfigs Failed", "RequestRefreshIPConfigs Failed", device_path, error_callback,
device_path,
error_callback,
std::string("Missing ") + shill::kIPConfigsProperty, ""); std::string("Missing ") + shill::kIPConfigsProperty, "");
return; return;
} }
...@@ -116,10 +111,7 @@ void SetDevicePropertyInternal( ...@@ -116,10 +111,7 @@ void SetDevicePropertyInternal(
const network_handler::ErrorCallback& error_callback) { const network_handler::ErrorCallback& error_callback) {
NET_LOG(USER) << "Device.SetProperty: " << property_name << " = " << value; NET_LOG(USER) << "Device.SetProperty: " << property_name << " = " << value;
DBusThreadManager::Get()->GetShillDeviceClient()->SetProperty( DBusThreadManager::Get()->GetShillDeviceClient()->SetProperty(
dbus::ObjectPath(device_path), dbus::ObjectPath(device_path), property_name, value, callback,
property_name,
value,
callback,
base::Bind(&HandleShillCallFailure, device_path, error_callback)); base::Bind(&HandleShillCallFailure, device_path, error_callback));
} }
...@@ -139,12 +131,11 @@ void CallPerformTDLSOperation( ...@@ -139,12 +131,11 @@ void CallPerformTDLSOperation(
const network_handler::StringResultCallback& callback, const network_handler::StringResultCallback& callback,
const network_handler::ErrorCallback& error_callback); const network_handler::ErrorCallback& error_callback);
void TDLSSuccessCallback( void TDLSSuccessCallback(const std::string& device_path,
const std::string& device_path, const TDLSOperationParams& params,
const TDLSOperationParams& params, const network_handler::StringResultCallback& callback,
const network_handler::StringResultCallback& callback, const network_handler::ErrorCallback& error_callback,
const network_handler::ErrorCallback& error_callback, const std::string& result) {
const std::string& result) {
std::string event_desc = "TDLSSuccessCallback: " + params.operation; std::string event_desc = "TDLSSuccessCallback: " + params.operation;
if (!result.empty()) if (!result.empty())
event_desc += ": " + result; event_desc += ": " + result;
...@@ -197,13 +188,12 @@ void TDLSSuccessCallback( ...@@ -197,13 +188,12 @@ void TDLSSuccessCallback(
request_delay); request_delay);
} }
void TDLSErrorCallback( void TDLSErrorCallback(const std::string& device_path,
const std::string& device_path, const TDLSOperationParams& params,
const TDLSOperationParams& params, const network_handler::StringResultCallback& callback,
const network_handler::StringResultCallback& callback, const network_handler::ErrorCallback& error_callback,
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) {
// If a Setup operation receives an InProgress error, retry. // If a Setup operation receives an InProgress error, retry.
const int kMaxRetries = 5; const int kMaxRetries = 5;
if ((params.operation == shill::kTDLSDiscoverOperation || if ((params.operation == shill::kTDLSDiscoverOperation ||
...@@ -234,8 +224,9 @@ void TDLSErrorCallback( ...@@ -234,8 +224,9 @@ void TDLSErrorCallback(
return; return;
const std::string error_name = const std::string error_name =
dbus_error_name == shill::kErrorResultInProgress ? dbus_error_name == shill::kErrorResultInProgress
NetworkDeviceHandler::kErrorTimeout : NetworkDeviceHandler::kErrorUnknown; ? NetworkDeviceHandler::kErrorTimeout
: NetworkDeviceHandler::kErrorUnknown;
const std::string& error_detail = params.ip_or_mac_address; const std::string& error_detail = params.ip_or_mac_address;
std::unique_ptr<base::DictionaryValue> error_data( std::unique_ptr<base::DictionaryValue> error_data(
network_handler::CreateDBusErrorData(device_path, error_name, network_handler::CreateDBusErrorData(device_path, error_name,
...@@ -253,13 +244,11 @@ void CallPerformTDLSOperation( ...@@ -253,13 +244,11 @@ void CallPerformTDLSOperation(
NET_LOG(EVENT) << "CallPerformTDLSOperation: " << params.operation << ": " NET_LOG(EVENT) << "CallPerformTDLSOperation: " << params.operation << ": "
<< device_path; << device_path;
DBusThreadManager::Get()->GetShillDeviceClient()->PerformTDLSOperation( DBusThreadManager::Get()->GetShillDeviceClient()->PerformTDLSOperation(
dbus::ObjectPath(device_path), dbus::ObjectPath(device_path), params.operation, params.ip_or_mac_address,
params.operation, base::Bind(&TDLSSuccessCallback, device_path, params, callback,
params.ip_or_mac_address, error_callback),
base::Bind(&TDLSSuccessCallback, base::Bind(&TDLSErrorCallback, device_path, params, callback,
device_path, params, callback, error_callback), error_callback));
base::Bind(&TDLSErrorCallback,
device_path, params, callback, error_callback));
} }
} // namespace } // namespace
...@@ -275,8 +264,8 @@ void NetworkDeviceHandlerImpl::GetDeviceProperties( ...@@ -275,8 +264,8 @@ void NetworkDeviceHandlerImpl::GetDeviceProperties(
const network_handler::ErrorCallback& error_callback) const { const network_handler::ErrorCallback& error_callback) const {
DBusThreadManager::Get()->GetShillDeviceClient()->GetProperties( DBusThreadManager::Get()->GetShillDeviceClient()->GetProperties(
dbus::ObjectPath(device_path), dbus::ObjectPath(device_path),
base::Bind(&network_handler::GetPropertiesCallback, base::Bind(&network_handler::GetPropertiesCallback, callback,
callback, error_callback, device_path)); error_callback, device_path));
} }
void NetworkDeviceHandlerImpl::SetDeviceProperty( void NetworkDeviceHandlerImpl::SetDeviceProperty(
...@@ -287,31 +276,29 @@ void NetworkDeviceHandlerImpl::SetDeviceProperty( ...@@ -287,31 +276,29 @@ void NetworkDeviceHandlerImpl::SetDeviceProperty(
const network_handler::ErrorCallback& error_callback) { const network_handler::ErrorCallback& error_callback) {
const char* const property_blacklist[] = { const char* const property_blacklist[] = {
// Must only be changed by policy/owner through. // Must only be changed by policy/owner through.
shill::kCellularAllowRoamingProperty shill::kCellularAllowRoamingProperty};
};
for (size_t i = 0; i < arraysize(property_blacklist); ++i) { for (size_t i = 0; i < arraysize(property_blacklist); ++i) {
if (property_name == property_blacklist[i]) { if (property_name == property_blacklist[i]) {
InvokeErrorCallback( InvokeErrorCallback(
device_path, device_path, error_callback,
error_callback,
"SetDeviceProperty called on blacklisted property " + property_name); "SetDeviceProperty called on blacklisted property " + property_name);
return; return;
} }
} }
SetDevicePropertyInternal( SetDevicePropertyInternal(device_path, property_name, value, callback,
device_path, property_name, value, callback, error_callback); error_callback);
} }
void NetworkDeviceHandlerImpl::RequestRefreshIPConfigs( void NetworkDeviceHandlerImpl::RequestRefreshIPConfigs(
const std::string& device_path, const std::string& device_path,
const base::Closure& callback, const base::Closure& callback,
const network_handler::ErrorCallback& error_callback) { const network_handler::ErrorCallback& error_callback) {
GetDeviceProperties(device_path, GetDeviceProperties(
base::Bind(&RefreshIPConfigsCallback, device_path,
callback, error_callback), base::Bind(&RefreshIPConfigsCallback, callback, error_callback),
error_callback); error_callback);
} }
void NetworkDeviceHandlerImpl::RegisterCellularNetwork( void NetworkDeviceHandlerImpl::RegisterCellularNetwork(
...@@ -322,9 +309,7 @@ void NetworkDeviceHandlerImpl::RegisterCellularNetwork( ...@@ -322,9 +309,7 @@ void NetworkDeviceHandlerImpl::RegisterCellularNetwork(
NET_LOG(USER) << "Device.RegisterCellularNetwork: " << device_path NET_LOG(USER) << "Device.RegisterCellularNetwork: " << device_path
<< " Id: " << network_id; << " Id: " << network_id;
DBusThreadManager::Get()->GetShillDeviceClient()->Register( DBusThreadManager::Get()->GetShillDeviceClient()->Register(
dbus::ObjectPath(device_path), dbus::ObjectPath(device_path), network_id, callback,
network_id,
callback,
base::Bind(&HandleShillCallFailure, device_path, error_callback)); base::Bind(&HandleShillCallFailure, device_path, error_callback));
} }
...@@ -336,9 +321,7 @@ void NetworkDeviceHandlerImpl::SetCarrier( ...@@ -336,9 +321,7 @@ void NetworkDeviceHandlerImpl::SetCarrier(
NET_LOG(USER) << "Device.SetCarrier: " << device_path NET_LOG(USER) << "Device.SetCarrier: " << device_path
<< " carrier: " << carrier; << " carrier: " << carrier;
DBusThreadManager::Get()->GetShillDeviceClient()->SetCarrier( DBusThreadManager::Get()->GetShillDeviceClient()->SetCarrier(
dbus::ObjectPath(device_path), dbus::ObjectPath(device_path), carrier, callback,
carrier,
callback,
base::Bind(&HandleShillCallFailure, device_path, error_callback)); base::Bind(&HandleShillCallFailure, device_path, error_callback));
} }
...@@ -350,10 +333,7 @@ void NetworkDeviceHandlerImpl::RequirePin( ...@@ -350,10 +333,7 @@ void NetworkDeviceHandlerImpl::RequirePin(
const network_handler::ErrorCallback& error_callback) { const network_handler::ErrorCallback& error_callback) {
NET_LOG(USER) << "Device.RequirePin: " << device_path << ": " << require_pin; NET_LOG(USER) << "Device.RequirePin: " << device_path << ": " << require_pin;
DBusThreadManager::Get()->GetShillDeviceClient()->RequirePin( DBusThreadManager::Get()->GetShillDeviceClient()->RequirePin(
dbus::ObjectPath(device_path), dbus::ObjectPath(device_path), pin, require_pin, callback,
pin,
require_pin,
callback,
base::Bind(&HandleShillCallFailure, device_path, error_callback)); base::Bind(&HandleShillCallFailure, device_path, error_callback));
} }
...@@ -364,9 +344,7 @@ void NetworkDeviceHandlerImpl::EnterPin( ...@@ -364,9 +344,7 @@ void NetworkDeviceHandlerImpl::EnterPin(
const network_handler::ErrorCallback& error_callback) { const network_handler::ErrorCallback& error_callback) {
NET_LOG(USER) << "Device.EnterPin: " << device_path; NET_LOG(USER) << "Device.EnterPin: " << device_path;
DBusThreadManager::Get()->GetShillDeviceClient()->EnterPin( DBusThreadManager::Get()->GetShillDeviceClient()->EnterPin(
dbus::ObjectPath(device_path), dbus::ObjectPath(device_path), pin, callback,
pin,
callback,
base::Bind(&HandleShillCallFailure, device_path, error_callback)); base::Bind(&HandleShillCallFailure, device_path, error_callback));
} }
...@@ -378,10 +356,7 @@ void NetworkDeviceHandlerImpl::UnblockPin( ...@@ -378,10 +356,7 @@ void NetworkDeviceHandlerImpl::UnblockPin(
const network_handler::ErrorCallback& error_callback) { const network_handler::ErrorCallback& error_callback) {
NET_LOG(USER) << "Device.UnblockPin: " << device_path; NET_LOG(USER) << "Device.UnblockPin: " << device_path;
DBusThreadManager::Get()->GetShillDeviceClient()->UnblockPin( DBusThreadManager::Get()->GetShillDeviceClient()->UnblockPin(
dbus::ObjectPath(device_path), dbus::ObjectPath(device_path), puk, new_pin, callback,
puk,
new_pin,
callback,
base::Bind(&HandleShillCallFailure, device_path, error_callback)); base::Bind(&HandleShillCallFailure, device_path, error_callback));
} }
...@@ -393,10 +368,7 @@ void NetworkDeviceHandlerImpl::ChangePin( ...@@ -393,10 +368,7 @@ void NetworkDeviceHandlerImpl::ChangePin(
const network_handler::ErrorCallback& error_callback) { const network_handler::ErrorCallback& error_callback) {
NET_LOG(USER) << "Device.ChangePin: " << device_path; NET_LOG(USER) << "Device.ChangePin: " << device_path;
DBusThreadManager::Get()->GetShillDeviceClient()->ChangePin( DBusThreadManager::Get()->GetShillDeviceClient()->ChangePin(
dbus::ObjectPath(device_path), dbus::ObjectPath(device_path), old_pin, new_pin, callback,
old_pin,
new_pin,
callback,
base::Bind(&HandleShillCallFailure, device_path, error_callback)); base::Bind(&HandleShillCallFailure, device_path, error_callback));
} }
...@@ -425,8 +397,8 @@ void NetworkDeviceHandlerImpl::SetWifiTDLSEnabled( ...@@ -425,8 +397,8 @@ void NetworkDeviceHandlerImpl::SetWifiTDLSEnabled(
params.operation = params.operation =
enabled ? shill::kTDLSDiscoverOperation : shill::kTDLSTeardownOperation; enabled ? shill::kTDLSDiscoverOperation : shill::kTDLSTeardownOperation;
params.ip_or_mac_address = ip_or_mac_address; params.ip_or_mac_address = ip_or_mac_address;
CallPerformTDLSOperation( CallPerformTDLSOperation(device_state->path(), params, callback,
device_state->path(), params, callback, error_callback); error_callback);
} }
void NetworkDeviceHandlerImpl::GetWifiTDLSStatus( void NetworkDeviceHandlerImpl::GetWifiTDLSStatus(
...@@ -440,32 +412,29 @@ void NetworkDeviceHandlerImpl::GetWifiTDLSStatus( ...@@ -440,32 +412,29 @@ void NetworkDeviceHandlerImpl::GetWifiTDLSStatus(
TDLSOperationParams params; TDLSOperationParams params;
params.operation = shill::kTDLSStatusOperation; params.operation = shill::kTDLSStatusOperation;
params.ip_or_mac_address = ip_or_mac_address; params.ip_or_mac_address = ip_or_mac_address;
CallPerformTDLSOperation( CallPerformTDLSOperation(device_state->path(), params, callback,
device_state->path(), params, callback, error_callback); error_callback);
} }
void NetworkDeviceHandlerImpl::AddWifiWakeOnPacketConnection( void NetworkDeviceHandlerImpl::AddWifiWakeOnPacketConnection(
const net::IPEndPoint& ip_endpoint, const net::IPEndPoint& ip_endpoint,
const base::Closure& callback, const base::Closure& callback,
const network_handler::ErrorCallback& error_callback) { const network_handler::ErrorCallback& error_callback) {
const DeviceState* device_state = GetWifiDeviceState(error_callback); const DeviceState* device_state = GetWifiDeviceState(error_callback);
if (!device_state) if (!device_state)
return; return;
NET_LOG(USER) << "Device.AddWakeOnWifi: " << device_state->path(); NET_LOG(USER) << "Device.AddWakeOnWifi: " << device_state->path();
DBusThreadManager::Get()->GetShillDeviceClient()->AddWakeOnPacketConnection( DBusThreadManager::Get()->GetShillDeviceClient()->AddWakeOnPacketConnection(
dbus::ObjectPath(device_state->path()), dbus::ObjectPath(device_state->path()), ip_endpoint, callback,
ip_endpoint, base::Bind(&HandleShillCallFailure, device_state->path(),
callback,
base::Bind(&HandleShillCallFailure,
device_state->path(),
error_callback)); error_callback));
} }
void NetworkDeviceHandlerImpl::RemoveWifiWakeOnPacketConnection( void NetworkDeviceHandlerImpl::RemoveWifiWakeOnPacketConnection(
const net::IPEndPoint& ip_endpoint, const net::IPEndPoint& ip_endpoint,
const base::Closure& callback, const base::Closure& callback,
const network_handler::ErrorCallback& error_callback) { const network_handler::ErrorCallback& error_callback) {
const DeviceState* device_state = GetWifiDeviceState(error_callback); const DeviceState* device_state = GetWifiDeviceState(error_callback);
if (!device_state) if (!device_state)
return; return;
...@@ -473,17 +442,15 @@ void NetworkDeviceHandlerImpl::RemoveWifiWakeOnPacketConnection( ...@@ -473,17 +442,15 @@ void NetworkDeviceHandlerImpl::RemoveWifiWakeOnPacketConnection(
NET_LOG(USER) << "Device.RemoveWakeOnWifi: " << device_state->path(); NET_LOG(USER) << "Device.RemoveWakeOnWifi: " << device_state->path();
DBusThreadManager::Get() DBusThreadManager::Get()
->GetShillDeviceClient() ->GetShillDeviceClient()
->RemoveWakeOnPacketConnection(dbus::ObjectPath(device_state->path()), ->RemoveWakeOnPacketConnection(
ip_endpoint, dbus::ObjectPath(device_state->path()), ip_endpoint, callback,
callback, base::Bind(&HandleShillCallFailure, device_state->path(),
base::Bind(&HandleShillCallFailure, error_callback));
device_state->path(),
error_callback));
} }
void NetworkDeviceHandlerImpl::RemoveAllWifiWakeOnPacketConnections( void NetworkDeviceHandlerImpl::RemoveAllWifiWakeOnPacketConnections(
const base::Closure& callback, const base::Closure& callback,
const network_handler::ErrorCallback& error_callback) { const network_handler::ErrorCallback& error_callback) {
const DeviceState* device_state = GetWifiDeviceState(error_callback); const DeviceState* device_state = GetWifiDeviceState(error_callback);
if (!device_state) if (!device_state)
return; return;
...@@ -491,11 +458,10 @@ void NetworkDeviceHandlerImpl::RemoveAllWifiWakeOnPacketConnections( ...@@ -491,11 +458,10 @@ void NetworkDeviceHandlerImpl::RemoveAllWifiWakeOnPacketConnections(
NET_LOG(USER) << "Device.RemoveAllWakeOnWifi: " << device_state->path(); NET_LOG(USER) << "Device.RemoveAllWakeOnWifi: " << device_state->path();
DBusThreadManager::Get() DBusThreadManager::Get()
->GetShillDeviceClient() ->GetShillDeviceClient()
->RemoveAllWakeOnPacketConnections(dbus::ObjectPath(device_state->path()), ->RemoveAllWakeOnPacketConnections(
callback, dbus::ObjectPath(device_state->path()), callback,
base::Bind(&HandleShillCallFailure, base::Bind(&HandleShillCallFailure, device_state->path(),
device_state->path(), error_callback));
error_callback));
} }
void NetworkDeviceHandlerImpl::DeviceListChanged() { void NetworkDeviceHandlerImpl::DeviceListChanged() {
...@@ -523,7 +489,7 @@ void NetworkDeviceHandlerImpl::ApplyCellularAllowRoamingToShill() { ...@@ -523,7 +489,7 @@ void NetworkDeviceHandlerImpl::ApplyCellularAllowRoamingToShill() {
return; return;
} }
for (NetworkStateHandler::DeviceStateList::const_iterator it = list.begin(); for (NetworkStateHandler::DeviceStateList::const_iterator it = list.begin();
it != list.end(); ++it) { it != list.end(); ++it) {
const DeviceState* device_state = *it; const DeviceState* device_state = *it;
bool current_allow_roaming = device_state->allow_roaming(); bool current_allow_roaming = device_state->allow_roaming();
......
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