| Index: chrome/browser/chromeos/cros/cros_network_functions.cc
|
| diff --git a/chrome/browser/chromeos/cros/cros_network_functions.cc b/chrome/browser/chromeos/cros/cros_network_functions.cc
|
| index b8cf380e3e112ff59393cb9eda2122df953ffba9..651112dfb95fc532d3c830ef02ec2e02f2c538c6 100644
|
| --- a/chrome/browser/chromeos/cros/cros_network_functions.cc
|
| +++ b/chrome/browser/chromeos/cros/cros_network_functions.cc
|
| @@ -5,6 +5,7 @@
|
| #include "chrome/browser/chromeos/cros/cros_network_functions.h"
|
|
|
| #include "base/bind.h"
|
| +#include "base/bind_helpers.h"
|
| #include "base/memory/scoped_ptr.h"
|
| #include "base/string_tokenizer.h"
|
| #include "base/stringprintf.h"
|
| @@ -21,6 +22,8 @@
|
| #include "dbus/object_path.h"
|
| #include "third_party/cros_system_api/dbus/service_constants.h"
|
|
|
| +using base::DoNothing;
|
| +
|
| namespace chromeos {
|
|
|
| namespace {
|
| @@ -180,7 +183,11 @@ class DataPlanUpdateWatcher : public CrosNetworkWatcher {
|
| };
|
|
|
| // Does nothing. Used as a callback.
|
| -void DoNothing(DBusMethodCallStatus call_status) {}
|
| +void DoNothingWithCallStatus(DBusMethodCallStatus call_status) {}
|
| +
|
| +// Ignores errors.
|
| +void IgnoreErrors(const std::string& error_name,
|
| + const std::string& error_message) {}
|
|
|
| // A callback used to implement CrosRequest*Properties functions.
|
| void RunCallbackWithDictionaryValue(const NetworkPropertiesCallback& callback,
|
| @@ -190,17 +197,32 @@ void RunCallbackWithDictionaryValue(const NetworkPropertiesCallback& callback,
|
| callback.Run(path, call_status == DBUS_METHOD_CALL_SUCCESS ? &value : NULL);
|
| }
|
|
|
| +// A callback used to implement CrosRequest*Properties functions.
|
| +void RunCallbackWithDictionaryValueNoStatus(
|
| + const NetworkPropertiesCallback& callback,
|
| + const std::string& path,
|
| + const base::DictionaryValue& value) {
|
| + callback.Run(path, &value);
|
| +}
|
| +
|
| +// A callback used to implement the error callback for CrosRequest*Properties
|
| +// functions.
|
| +void RunCallbackWithDictionaryValueError(
|
| + const NetworkPropertiesCallback& callback,
|
| + const std::string& path,
|
| + const std::string& error_name,
|
| + const std::string& error_message) {
|
| + callback.Run(path, NULL);
|
| +}
|
| +
|
| // Used as a callback for ShillManagerClient::GetService
|
| void OnGetService(const NetworkPropertiesCallback& callback,
|
| - DBusMethodCallStatus call_status,
|
| const dbus::ObjectPath& service_path) {
|
| - if (call_status == DBUS_METHOD_CALL_SUCCESS) {
|
| - VLOG(1) << "OnGetServiceService: " << service_path.value();
|
| - DBusThreadManager::Get()->GetShillServiceClient()->GetProperties(
|
| - service_path, base::Bind(&RunCallbackWithDictionaryValue,
|
| - callback,
|
| - service_path.value()));
|
| - }
|
| + VLOG(1) << "OnGetServiceService: " << service_path.value();
|
| + DBusThreadManager::Get()->GetShillServiceClient()->GetProperties(
|
| + service_path, base::Bind(&RunCallbackWithDictionaryValue,
|
| + callback,
|
| + service_path.value()));
|
| }
|
|
|
| // A callback used to call a NetworkOperationCallback on error.
|
| @@ -316,20 +338,23 @@ void CrosSetNetworkServiceProperty(const std::string& service_path,
|
| const base::Value& value) {
|
| DBusThreadManager::Get()->GetShillServiceClient()->SetProperty(
|
| dbus::ObjectPath(service_path), property, value,
|
| - base::Bind(&DoNothing));
|
| + base::Bind(&DoNothing),
|
| + base::Bind(&IgnoreErrors));
|
| }
|
|
|
| void CrosClearNetworkServiceProperty(const std::string& service_path,
|
| const std::string& property) {
|
| DBusThreadManager::Get()->GetShillServiceClient()->ClearProperty(
|
| - dbus::ObjectPath(service_path), property, base::Bind(&DoNothing));
|
| + dbus::ObjectPath(service_path), property, base::Bind(&DoNothing),
|
| + base::Bind(&IgnoreErrors));
|
| }
|
|
|
| void CrosSetNetworkDeviceProperty(const std::string& device_path,
|
| const std::string& property,
|
| const base::Value& value) {
|
| DBusThreadManager::Get()->GetShillDeviceClient()->SetProperty(
|
| - dbus::ObjectPath(device_path), property, value, base::Bind(&DoNothing));
|
| + dbus::ObjectPath(device_path), property, value, base::Bind(&DoNothing),
|
| + base::Bind(&IgnoreErrors));
|
| }
|
|
|
| void CrosSetNetworkIPConfigProperty(const std::string& ipconfig_path,
|
| @@ -337,19 +362,23 @@ void CrosSetNetworkIPConfigProperty(const std::string& ipconfig_path,
|
| const base::Value& value) {
|
| DBusThreadManager::Get()->GetShillIPConfigClient()->SetProperty(
|
| dbus::ObjectPath(ipconfig_path), property, value,
|
| - base::Bind(&DoNothing));
|
| + base::Bind(&DoNothingWithCallStatus));
|
| }
|
|
|
| void CrosSetNetworkManagerProperty(const std::string& property,
|
| const base::Value& value) {
|
| DBusThreadManager::Get()->GetShillManagerClient()->SetProperty(
|
| - property, value, base::Bind(&DoNothing));
|
| + property, value, base::Bind(&DoNothing),
|
| + base::Bind(&IgnoreErrors));
|
| }
|
|
|
| void CrosDeleteServiceFromProfile(const std::string& profile_path,
|
| const std::string& service_path) {
|
| DBusThreadManager::Get()->GetShillProfileClient()->DeleteEntry(
|
| - dbus::ObjectPath(profile_path), service_path, base::Bind(&DoNothing));
|
| + dbus::ObjectPath(profile_path),
|
| + service_path,
|
| + base::Bind(&DoNothing),
|
| + base::Bind(&IgnoreErrors));
|
| }
|
|
|
| void CrosRequestCellularDataPlanUpdate(const std::string& modem_service_path) {
|
| @@ -423,7 +452,9 @@ void CrosRequestNetworkProfileProperties(
|
| const NetworkPropertiesCallback& callback) {
|
| DBusThreadManager::Get()->GetShillProfileClient()->GetProperties(
|
| dbus::ObjectPath(profile_path),
|
| - base::Bind(&RunCallbackWithDictionaryValue, callback, profile_path));
|
| + base::Bind(&RunCallbackWithDictionaryValueNoStatus,
|
| + callback, profile_path),
|
| + base::Bind(&RunCallbackWithDictionaryValueError, callback, profile_path));
|
| }
|
|
|
| void CrosRequestNetworkProfileEntryProperties(
|
| @@ -433,7 +464,10 @@ void CrosRequestNetworkProfileEntryProperties(
|
| DBusThreadManager::Get()->GetShillProfileClient()->GetEntry(
|
| dbus::ObjectPath(profile_path),
|
| profile_entry_path,
|
| - base::Bind(&RunCallbackWithDictionaryValue,
|
| + base::Bind(&RunCallbackWithDictionaryValueNoStatus,
|
| + callback,
|
| + profile_entry_path),
|
| + base::Bind(&RunCallbackWithDictionaryValueError,
|
| callback,
|
| profile_entry_path));
|
| }
|
| @@ -459,7 +493,8 @@ void CrosRequestHiddenWifiNetworkProperties(
|
| // |properties| and return a new or existing service to OnGetService().
|
| // OnGetService will then call GetProperties which will then call callback.
|
| DBusThreadManager::Get()->GetShillManagerClient()->GetService(
|
| - properties, base::Bind(&OnGetService, callback));
|
| + properties, base::Bind(&OnGetService, callback),
|
| + base::Bind(&IgnoreErrors));
|
| }
|
|
|
| void CrosRequestVirtualNetworkProperties(
|
| @@ -489,32 +524,38 @@ void CrosRequestVirtualNetworkProperties(
|
| // |properties| and pass a new or existing service to OnGetService().
|
| // OnGetService will then call GetProperties which will then call callback.
|
| DBusThreadManager::Get()->GetShillManagerClient()->GetService(
|
| - properties, base::Bind(&OnGetService, callback));
|
| + properties, base::Bind(&OnGetService, callback),
|
| + base::Bind(&IgnoreErrors));
|
| }
|
|
|
| void CrosRequestNetworkServiceDisconnect(const std::string& service_path) {
|
| DBusThreadManager::Get()->GetShillServiceClient()->Disconnect(
|
| - dbus::ObjectPath(service_path), base::Bind(&DoNothing));
|
| + dbus::ObjectPath(service_path), base::Bind(&DoNothing),
|
| + base::Bind(&IgnoreErrors));
|
| }
|
|
|
| void CrosRequestRemoveNetworkService(const std::string& service_path) {
|
| DBusThreadManager::Get()->GetShillServiceClient()->Remove(
|
| - dbus::ObjectPath(service_path), base::Bind(&DoNothing));
|
| + dbus::ObjectPath(service_path), base::Bind(&DoNothing),
|
| + base::Bind(&IgnoreErrors));
|
| }
|
|
|
| void CrosRequestNetworkScan(const std::string& network_type) {
|
| DBusThreadManager::Get()->GetShillManagerClient()->RequestScan(
|
| - network_type, base::Bind(&DoNothing));
|
| + network_type, base::Bind(&DoNothing),
|
| + base::Bind(&IgnoreErrors));
|
| }
|
|
|
| void CrosRequestNetworkDeviceEnable(const std::string& network_type,
|
| bool enable) {
|
| if (enable) {
|
| DBusThreadManager::Get()->GetShillManagerClient()->EnableTechnology(
|
| - network_type, base::Bind(&DoNothing));
|
| + network_type, base::Bind(&DoNothing),
|
| + base::Bind(&IgnoreErrors));
|
| } else {
|
| DBusThreadManager::Get()->GetShillManagerClient()->DisableTechnology(
|
| - network_type, base::Bind(&DoNothing));
|
| + network_type, base::Bind(&DoNothing),
|
| + base::Bind(&IgnoreErrors));
|
| }
|
| }
|
|
|
| @@ -563,7 +604,7 @@ void CrosRequestChangePin(const std::string& device_path,
|
|
|
| void CrosProposeScan(const std::string& device_path) {
|
| DBusThreadManager::Get()->GetShillDeviceClient()->ProposeScan(
|
| - dbus::ObjectPath(device_path), base::Bind(&DoNothing));
|
| + dbus::ObjectPath(device_path), base::Bind(&DoNothingWithCallStatus));
|
| }
|
|
|
| void CrosRequestCellularRegister(const std::string& device_path,
|
| @@ -579,7 +620,8 @@ void CrosRequestCellularRegister(const std::string& device_path,
|
| bool CrosSetOfflineMode(bool offline) {
|
| base::FundamentalValue value(offline);
|
| DBusThreadManager::Get()->GetShillManagerClient()->SetProperty(
|
| - flimflam::kOfflineModeProperty, value, base::Bind(&DoNothing));
|
| + flimflam::kOfflineModeProperty, value, base::Bind(&DoNothing),
|
| + base::Bind(&IgnoreErrors));
|
| return true;
|
| }
|
|
|
| @@ -667,7 +709,7 @@ bool CrosRemoveIPConfig(const std::string& ipconfig_path) {
|
| void CrosRequestIPConfigRefresh(const std::string& ipconfig_path) {
|
| DBusThreadManager::Get()->GetShillIPConfigClient()->Refresh(
|
| dbus::ObjectPath(ipconfig_path),
|
| - base::Bind(&DoNothing));
|
| + base::Bind(&DoNothingWithCallStatus));
|
| }
|
|
|
| bool CrosGetWifiAccessPoints(WifiAccessPointVector* result) {
|
| @@ -758,7 +800,8 @@ bool CrosGetWifiAccessPoints(WifiAccessPointVector* result) {
|
|
|
| void CrosConfigureService(const base::DictionaryValue& properties) {
|
| DBusThreadManager::Get()->GetShillManagerClient()->ConfigureService(
|
| - properties, base::Bind(&DoNothing));
|
| + properties, base::Bind(&DoNothing),
|
| + base::Bind(&IgnoreErrors));
|
| }
|
|
|
| std::string CrosPrefixLengthToNetmask(int32 prefix_length) {
|
|
|