Index: chromeos/dbus/fake_shill_manager_client.cc |
diff --git a/chromeos/dbus/fake_shill_manager_client.cc b/chromeos/dbus/fake_shill_manager_client.cc |
index 3b9a02d0a295ad091fb2d51885f75a99c2879de7..de7ff77d2172e923c4cb4d7bc25ff5cd380bbc53 100644 |
--- a/chromeos/dbus/fake_shill_manager_client.cc |
+++ b/chromeos/dbus/fake_shill_manager_client.cc |
@@ -462,16 +462,14 @@ void FakeShillManagerClient::SetManagerProperty(const std::string& key, |
} |
void FakeShillManagerClient::AddManagerService( |
- const std::string& service_path) { |
+ const std::string& service_path, |
+ bool notify_observers) { |
DVLOG(2) << "AddManagerService: " << service_path; |
GetListProperty(shill::kServiceCompleteListProperty)->AppendIfNotPresent( |
base::Value::CreateStringValue(service_path)); |
SortManagerServices(false); |
- CallNotifyObserversPropertyChanged(shill::kServiceCompleteListProperty); |
- // SortManagerServices will add the service to Services if it is visible. |
- const base::ListValue* services = GetListProperty(shill::kServicesProperty); |
- if (services->Find(base::StringValue(service_path)) != services->end()) |
- CallNotifyObserversPropertyChanged(shill::kServicesProperty); |
+ if (notify_observers) |
+ CallNotifyObserversPropertyChanged(shill::kServiceCompleteListProperty); |
} |
void FakeShillManagerClient::RemoveManagerService( |
@@ -481,18 +479,12 @@ void FakeShillManagerClient::RemoveManagerService( |
GetListProperty(shill::kServiceCompleteListProperty)->Remove( |
service_path_value, NULL); |
CallNotifyObserversPropertyChanged(shill::kServiceCompleteListProperty); |
- if (GetListProperty(shill::kServicesProperty)->Remove( |
- service_path_value, NULL)) { |
- CallNotifyObserversPropertyChanged(shill::kServicesProperty); |
- } |
} |
void FakeShillManagerClient::ClearManagerServices() { |
DVLOG(1) << "ClearManagerServices"; |
GetListProperty(shill::kServiceCompleteListProperty)->Clear(); |
- GetListProperty(shill::kServicesProperty)->Clear(); |
CallNotifyObserversPropertyChanged(shill::kServiceCompleteListProperty); |
- CallNotifyObserversPropertyChanged(shill::kServicesProperty); |
} |
void FakeShillManagerClient::ServiceStateChanged( |
@@ -514,8 +506,6 @@ void FakeShillManagerClient::SortManagerServices(bool notify) { |
shill::kTypeWimax, |
shill::kTypeVPN}; |
- base::ListValue* service_list = GetListProperty(shill::kServicesProperty); |
- scoped_ptr<base::ListValue> prev_service_list(service_list->DeepCopy()); |
base::ListValue* complete_list = |
GetListProperty(shill::kServiceCompleteListProperty); |
if (complete_list->empty()) |
@@ -533,26 +523,16 @@ void FakeShillManagerClient::SortManagerServices(bool notify) { |
&inactive_services, |
&disabled_services); |
} |
- service_list->Clear(); |
complete_list->Clear(); |
- for (size_t i = 0; i < active_services.size(); ++i) { |
+ for (size_t i = 0; i < active_services.size(); ++i) |
complete_list->AppendString(active_services[i]); |
- service_list->AppendString(active_services[i]); |
- } |
- for (size_t i = 0; i < inactive_services.size(); ++i) { |
+ for (size_t i = 0; i < inactive_services.size(); ++i) |
complete_list->AppendString(inactive_services[i]); |
- service_list->AppendString(inactive_services[i]); |
- } |
- for (size_t i = 0; i < disabled_services.size(); ++i) { |
+ for (size_t i = 0; i < disabled_services.size(); ++i) |
complete_list->AppendString(disabled_services[i]); |
- } |
- if (notify) { |
- if (!service_list->Equals(prev_service_list.get())) |
- CallNotifyObserversPropertyChanged(shill::kServicesProperty); |
- if (!complete_list->Equals(prev_complete_list.get())) |
- CallNotifyObserversPropertyChanged(shill::kServiceCompleteListProperty); |
- } |
+ if (notify && !complete_list->Equals(prev_complete_list.get())) |
+ CallNotifyObserversPropertyChanged(shill::kServiceCompleteListProperty); |
// Set the first active service as the Default service. |
std::string new_default_service; |
@@ -901,7 +881,6 @@ void FakeShillManagerClient::ScanCompleted(const std::string& device_path, |
} |
DVLOG(2) << "ScanCompleted"; |
CallNotifyObserversPropertyChanged(shill::kServiceCompleteListProperty); |
- CallNotifyObserversPropertyChanged(shill::kServicesProperty); |
base::MessageLoop::current()->PostTask(FROM_HERE, callback); |
} |