| Index: chromeos/dbus/shill_manager_client_stub.cc
|
| diff --git a/chromeos/dbus/shill_manager_client_stub.cc b/chromeos/dbus/shill_manager_client_stub.cc
|
| index cd406c31166516d111a6f2c1d37c5d24d97faa2a..3eb081383f7dd3f5fe14fc0ac6498926c09b1b14 100644
|
| --- a/chromeos/dbus/shill_manager_client_stub.cc
|
| +++ b/chromeos/dbus/shill_manager_client_stub.cc
|
| @@ -39,7 +39,7 @@ struct ValueEquals {
|
| } // namespace
|
|
|
| ShillManagerClientStub::ShillManagerClientStub()
|
| -: weak_ptr_factory_(this) {
|
| + : weak_ptr_factory_(this) {
|
| SetDefaultProperties();
|
| }
|
|
|
| @@ -180,9 +180,6 @@ void ShillManagerClientStub::ConfigureService(
|
| const base::DictionaryValue& properties,
|
| const ObjectPathCallback& callback,
|
| const ErrorCallback& error_callback) {
|
| - if (callback.is_null())
|
| - return;
|
| -
|
| ShillServiceClient::TestInterface* service_client =
|
| DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface();
|
|
|
| @@ -190,10 +187,13 @@ void ShillManagerClientStub::ConfigureService(
|
| std::string type;
|
| if (!properties.GetString(flimflam::kGuidProperty, &guid) ||
|
| !properties.GetString(flimflam::kTypeProperty, &type)) {
|
| + LOG(ERROR) << "ConfigureService requies GUID and Type to be defined";
|
| // If the properties aren't filled out completely, then just return an empty
|
| // object path.
|
| - MessageLoop::current()->PostTask(
|
| - FROM_HERE, base::Bind(callback, dbus::ObjectPath()));
|
| + if (!callback.is_null()) {
|
| + MessageLoop::current()->PostTask(
|
| + FROM_HERE, base::Bind(callback, dbus::ObjectPath()));
|
| + }
|
| return;
|
| }
|
|
|
| @@ -231,8 +231,10 @@ void ShillManagerClientStub::ConfigureService(
|
| DBusThreadManager::Get()->GetShillProfileClient()->GetTestInterface();
|
| profile_test->AddService(service_path);
|
|
|
| - MessageLoop::current()->PostTask(
|
| - FROM_HERE, base::Bind(callback, dbus::ObjectPath(service_path)));
|
| + if (!callback.is_null()) {
|
| + MessageLoop::current()->PostTask(
|
| + FROM_HERE, base::Bind(callback, dbus::ObjectPath(service_path)));
|
| + }
|
| }
|
|
|
| void ShillManagerClientStub::ConfigureServiceForProfile(
|
| @@ -320,53 +322,6 @@ void ShillManagerClientStub::ClearDevices() {
|
| CallNotifyObserversPropertyChanged(flimflam::kDevicesProperty, 0);
|
| }
|
|
|
| -void ShillManagerClientStub::ClearServices() {
|
| - GetListProperty(flimflam::kServicesProperty)->Clear();
|
| - GetListProperty(flimflam::kServiceWatchListProperty)->Clear();
|
| - CallNotifyObserversPropertyChanged(flimflam::kServicesProperty, 0);
|
| - CallNotifyObserversPropertyChanged(flimflam::kServiceWatchListProperty, 0);
|
| -}
|
| -
|
| -void ShillManagerClientStub::AddService(const std::string& service_path,
|
| - bool add_to_watch_list) {
|
| - if (GetListProperty(flimflam::kServicesProperty)->AppendIfNotPresent(
|
| - base::Value::CreateStringValue(service_path))) {
|
| - CallNotifyObserversPropertyChanged(flimflam::kServicesProperty, 0);
|
| - }
|
| - if (add_to_watch_list)
|
| - AddServiceToWatchList(service_path);
|
| -}
|
| -
|
| -void ShillManagerClientStub::AddServiceAtIndex(const std::string& service_path,
|
| - size_t index,
|
| - bool add_to_watch_list) {
|
| - base::StringValue path_value(service_path);
|
| - base::ListValue* service_list =
|
| - GetListProperty(flimflam::kServicesProperty);
|
| - base::ListValue::iterator iter =
|
| - std::find_if(service_list->begin(), service_list->end(),
|
| - ValueEquals(&path_value));
|
| - if (iter != service_list->end())
|
| - service_list->Erase(iter, NULL);
|
| - service_list->Insert(index, path_value.DeepCopy());
|
| - CallNotifyObserversPropertyChanged(flimflam::kServicesProperty, 0);
|
| - if (add_to_watch_list)
|
| - AddServiceToWatchList(service_path);
|
| -}
|
| -
|
| -void ShillManagerClientStub::RemoveService(const std::string& service_path) {
|
| - base::StringValue service_path_value(service_path);
|
| - if (GetListProperty(flimflam::kServicesProperty)->Remove(
|
| - service_path_value, NULL)) {
|
| - CallNotifyObserversPropertyChanged(flimflam::kServicesProperty, 0);
|
| - }
|
| - if (GetListProperty(flimflam::kServiceWatchListProperty)->Remove(
|
| - service_path_value, NULL)) {
|
| - CallNotifyObserversPropertyChanged(
|
| - flimflam::kServiceWatchListProperty, 0);
|
| - }
|
| -}
|
| -
|
| void ShillManagerClientStub::AddTechnology(const std::string& type,
|
| bool enabled) {
|
| if (GetListProperty(flimflam::kAvailableTechnologiesProperty)->
|
| @@ -417,6 +372,57 @@ void ShillManagerClientStub::ClearProperties() {
|
| stub_properties_.Clear();
|
| }
|
|
|
| +void ShillManagerClientStub::MoveServiceToIndex(
|
| + const std::string& service_path,
|
| + size_t index,
|
| + bool add_to_watch_list) {
|
| + base::StringValue path_value(service_path);
|
| + base::ListValue* service_list = GetListProperty(flimflam::kServicesProperty);
|
| + base::ListValue::iterator iter =
|
| + std::find_if(service_list->begin(), service_list->end(),
|
| + ValueEquals(&path_value));
|
| + if (iter == service_list->end()) {
|
| + LOG(ERROR) << "Service not found to move: " << service_path;
|
| + return;
|
| + }
|
| + service_list->Erase(iter, NULL);
|
| + service_list->Insert(index, path_value.DeepCopy());
|
| + CallNotifyObserversPropertyChanged(flimflam::kServicesProperty, 0);
|
| + if (add_to_watch_list)
|
| + AddServiceToWatchList(service_path);
|
| +}
|
| +
|
| +void ShillManagerClientStub::AddManagerService(const std::string& service_path,
|
| + bool add_to_watch_list) {
|
| + if (GetListProperty(flimflam::kServicesProperty)->AppendIfNotPresent(
|
| + base::Value::CreateStringValue(service_path))) {
|
| + CallNotifyObserversPropertyChanged(flimflam::kServicesProperty, 0);
|
| + }
|
| + if (add_to_watch_list)
|
| + AddServiceToWatchList(service_path);
|
| +}
|
| +
|
| +void ShillManagerClientStub::RemoveManagerService(
|
| + const std::string& service_path) {
|
| + base::StringValue service_path_value(service_path);
|
| + if (GetListProperty(flimflam::kServicesProperty)->Remove(
|
| + service_path_value, NULL)) {
|
| + CallNotifyObserversPropertyChanged(flimflam::kServicesProperty, 0);
|
| + }
|
| + if (GetListProperty(flimflam::kServiceWatchListProperty)->Remove(
|
| + service_path_value, NULL)) {
|
| + CallNotifyObserversPropertyChanged(
|
| + flimflam::kServiceWatchListProperty, 0);
|
| + }
|
| +}
|
| +
|
| +void ShillManagerClientStub::ClearManagerServices() {
|
| + GetListProperty(flimflam::kServicesProperty)->Clear();
|
| + GetListProperty(flimflam::kServiceWatchListProperty)->Clear();
|
| + CallNotifyObserversPropertyChanged(flimflam::kServicesProperty, 0);
|
| + CallNotifyObserversPropertyChanged(flimflam::kServiceWatchListProperty, 0);
|
| +}
|
| +
|
| void ShillManagerClientStub::AddGeoNetwork(
|
| const std::string& technology,
|
| const base::DictionaryValue& network) {
|
|
|