Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2330)

Unified Diff: chromeos/dbus/fake_shill_manager_client.cc

Issue 280023003: Implement networkingPrivate.getNetworks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Feedback Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 117f85013be85739a469398546f6bad78024f8da..7198acd70dcc7040e1758ccbfdd5c1472fec8b68 100644
--- a/chromeos/dbus/fake_shill_manager_client.cc
+++ b/chromeos/dbus/fake_shill_manager_client.cc
@@ -453,25 +453,29 @@ void FakeShillManagerClient::AddManagerService(const std::string& service_path,
}
void FakeShillManagerClient::RemoveManagerService(
- const std::string& service_path) {
+ const std::string& service_path,
+ bool remove_from_complete_list) {
base::StringValue service_path_value(service_path);
+ if (remove_from_complete_list &&
+ GetListProperty(shill::kServiceCompleteListProperty)->Remove(
+ service_path_value, NULL)) {
+ CallNotifyObserversPropertyChanged(shill::kServiceCompleteListProperty);
pneubeck (no reviews) 2014/05/16 13:18:55 I think the reason for this notification missing w
stevenjb 2014/05/16 17:35:23 Ah, you are correct, I'll remove these. Done.
+ }
if (GetListProperty(shill::kServicesProperty)->Remove(
service_path_value, NULL)) {
CallNotifyObserversPropertyChanged(shill::kServicesProperty);
}
- GetListProperty(shill::kServiceCompleteListProperty)->Remove(
- service_path_value, NULL);
if (GetListProperty(shill::kServiceWatchListProperty)->Remove(
service_path_value, NULL)) {
- CallNotifyObserversPropertyChanged(
- shill::kServiceWatchListProperty);
+ CallNotifyObserversPropertyChanged(shill::kServiceWatchListProperty);
}
}
void FakeShillManagerClient::ClearManagerServices() {
- GetListProperty(shill::kServicesProperty)->Clear();
GetListProperty(shill::kServiceCompleteListProperty)->Clear();
+ GetListProperty(shill::kServicesProperty)->Clear();
GetListProperty(shill::kServiceWatchListProperty)->Clear();
+ CallNotifyObserversPropertyChanged(shill::kServiceCompleteListProperty);
pneubeck (no reviews) 2014/05/16 13:18:55 ditto
stevenjb 2014/05/16 17:35:23 Done.
CallNotifyObserversPropertyChanged(shill::kServicesProperty);
CallNotifyObserversPropertyChanged(shill::kServiceWatchListProperty);
}
@@ -488,6 +492,11 @@ void FakeShillManagerClient::ServiceStateChanged(
}
void FakeShillManagerClient::SortManagerServices() {
+ SortServiceList(shill::kServicesProperty);
+ SortServiceList(shill::kServiceCompleteListProperty);
+}
+
+void FakeShillManagerClient::SortServiceList(const std::string& property) {
static const char* ordered_types[] = {
shill::kTypeEthernet,
shill::kTypeWifi,
@@ -495,28 +504,26 @@ void FakeShillManagerClient::SortManagerServices() {
shill::kTypeWimax,
shill::kTypeVPN
};
- base::ListValue* service_list = GetListProperty(shill::kServicesProperty);
- if (!service_list || service_list->empty()) {
- if (!default_service_.empty()) {
- default_service_.clear();
- base::StringValue empty_value("");
- SetManagerProperty(shill::kDefaultServiceProperty, empty_value);
- }
- return;
- }
+
+ base::ListValue* service_list = GetListProperty(property);
std::vector<std::string> active_services;
std::vector<std::string> inactive_services;
- for (size_t i = 0; i < arraysize(ordered_types); ++i) {
- AppendServicesForType(service_list, ordered_types[i],
+ if (service_list && !service_list->empty()) {
+ for (size_t i = 0; i < arraysize(ordered_types); ++i) {
+ AppendServicesForType(service_list, ordered_types[i],
&active_services, &inactive_services);
+ }
+ service_list->Clear();
+ for (size_t i = 0; i < active_services.size(); ++i)
+ service_list->AppendString(active_services[i]);
+ for (size_t i = 0; i < inactive_services.size(); ++i)
+ service_list->AppendString(inactive_services[i]);
+
+ CallNotifyObserversPropertyChanged(property);
}
- service_list->Clear();
- for (size_t i = 0; i < active_services.size(); ++i)
- service_list->AppendString(active_services[i]);
- for (size_t i = 0; i < inactive_services.size(); ++i)
- service_list->AppendString(inactive_services[i]);
- CallNotifyObserversPropertyChanged(shill::kServicesProperty);
+ if (property != shill::kServicesProperty)
+ return;
// Set the first active service as the Default service.
std::string new_default_service;
@@ -540,6 +547,8 @@ void FakeShillManagerClient::SortManagerServices() {
base::StringValue default_service_value(default_service_);
SetManagerProperty(shill::kDefaultServiceProperty, default_service_value);
}
+
+ return;
}

Powered by Google App Engine
This is Rietveld 408576698