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 2bac7dcfe1648fbbe5cb6679faf01940535f3afa..35e8e25cc124d2a472fee9aab307e19f6c8745aa 100644 |
--- a/chromeos/dbus/shill_manager_client_stub.cc |
+++ b/chromeos/dbus/shill_manager_client_stub.cc |
@@ -135,14 +135,17 @@ void ShillManagerClientStub::EnableTechnology( |
} |
return; |
} |
- enabled_list->AppendIfNotPresent(new base::StringValue(type)); |
- CallNotifyObserversPropertyChanged( |
- flimflam::kEnabledTechnologiesProperty, 0); |
- if (!callback.is_null()) |
- MessageLoop::current()->PostTask(FROM_HERE, callback); |
- // May affect available services |
- CallNotifyObserversPropertyChanged(flimflam::kServicesProperty, 0); |
- CallNotifyObserversPropertyChanged(flimflam::kServiceWatchListProperty, 0); |
+ if (CommandLine::ForCurrentProcess()->HasSwitch( |
+ chromeos::switches::kEnableStubInteractive)) { |
+ const int kEnableTechnologyDelaySeconds = 3; |
+ MessageLoop::current()->PostDelayedTask( |
+ FROM_HERE, |
+ base::Bind(&ShillManagerClientStub::SetTechnologyEnabled, |
+ weak_ptr_factory_.GetWeakPtr(), type, callback, true), |
+ base::TimeDelta::FromSeconds(kEnableTechnologyDelaySeconds)); |
+ } else { |
+ SetTechnologyEnabled(type, callback, true); |
+ } |
} |
void ShillManagerClientStub::DisableTechnology( |
@@ -159,16 +162,18 @@ void ShillManagerClientStub::DisableTechnology( |
} |
return; |
} |
- base::StringValue type_value(type); |
- enabled_list->Remove(type_value, NULL); |
- CallNotifyObserversPropertyChanged( |
- flimflam::kEnabledTechnologiesProperty, 0); |
- if (!callback.is_null()) |
- MessageLoop::current()->PostTask(FROM_HERE, callback); |
- // May affect available services |
- CallNotifyObserversPropertyChanged(flimflam::kServicesProperty, 0); |
- CallNotifyObserversPropertyChanged(flimflam::kServiceWatchListProperty, 0); |
- } |
+ if (CommandLine::ForCurrentProcess()->HasSwitch( |
+ chromeos::switches::kEnableStubInteractive)) { |
+ const int kDisableTechnologyDelaySeconds = 3; |
+ MessageLoop::current()->PostDelayedTask( |
+ FROM_HERE, |
+ base::Bind(&ShillManagerClientStub::SetTechnologyEnabled, |
+ weak_ptr_factory_.GetWeakPtr(), type, callback, false), |
+ base::TimeDelta::FromSeconds(kDisableTechnologyDelaySeconds)); |
+ } else { |
+ SetTechnologyEnabled(type, callback, false); |
+ } |
+} |
void ShillManagerClientStub::ConfigureService( |
const base::DictionaryValue& properties, |
@@ -448,6 +453,10 @@ void ShillManagerClientStub::CallNotifyObserversPropertyChanged( |
// initial setup). |
if (observer_list_.size() == 0) |
return; |
+ if (!CommandLine::ForCurrentProcess()->HasSwitch( |
+ chromeos::switches::kEnableStubInteractive)) { |
+ delay_ms = 0; |
+ } |
MessageLoop::current()->PostDelayedTask( |
FROM_HERE, |
base::Bind(&ShillManagerClientStub::NotifyObserversPropertyChanged, |
@@ -501,6 +510,27 @@ bool ShillManagerClientStub::TechnologyEnabled(const std::string& type) const { |
return enabled; |
} |
+void ShillManagerClientStub::SetTechnologyEnabled( |
+ const std::string& type, |
+ const base::Closure& callback, |
+ bool enabled) { |
+ base::ListValue* enabled_list = NULL; |
+ stub_properties_.GetListWithoutPathExpansion( |
+ flimflam::kEnabledTechnologiesProperty, &enabled_list); |
+ DCHECK(enabled_list); |
+ if (enabled) |
+ enabled_list->AppendIfNotPresent(new base::StringValue(type)); |
+ else |
+ enabled_list->Remove(base::StringValue(type), NULL); |
+ CallNotifyObserversPropertyChanged( |
+ flimflam::kEnabledTechnologiesProperty, 0 /* already delayed */); |
+ if (!callback.is_null()) |
+ MessageLoop::current()->PostTask(FROM_HERE, callback); |
+ // May affect available services |
+ CallNotifyObserversPropertyChanged(flimflam::kServicesProperty, 0); |
+ CallNotifyObserversPropertyChanged(flimflam::kServiceWatchListProperty, 0); |
+} |
+ |
base::ListValue* ShillManagerClientStub::GetEnabledServiceList( |
const std::string& property) const { |
base::ListValue* new_service_list = new base::ListValue; |