| 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 b3d3a876551355d622cca2fa667a8ad56ed0ecce..a81ef55829bad97f287988761b47dbf7c067da7d 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(
|
| @@ -319,51 +321,6 @@ void ShillManagerClientStub::ClearDevices() {
|
| stub_properties_.Remove(flimflam::kDevicesProperty, NULL);
|
| }
|
|
|
| -void ShillManagerClientStub::ClearServices() {
|
| - stub_properties_.Remove(flimflam::kServicesProperty, NULL);
|
| - stub_properties_.Remove(flimflam::kServiceWatchListProperty, NULL);
|
| -}
|
| -
|
| -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)->
|
| @@ -414,6 +371,55 @@ 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() {
|
| + stub_properties_.Remove(flimflam::kServicesProperty, NULL);
|
| + stub_properties_.Remove(flimflam::kServiceWatchListProperty, NULL);
|
| +}
|
| +
|
| void ShillManagerClientStub::AddGeoNetwork(
|
| const std::string& technology,
|
| const base::DictionaryValue& network) {
|
|
|