| 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 f19c5a5d2de8209759cc5ff623349f409562625c..8cadf5cbc1c815cfcc3f685206848ec694129fd5 100644
|
| --- a/chromeos/dbus/shill_manager_client_stub.cc
|
| +++ b/chromeos/dbus/shill_manager_client_stub.cc
|
| @@ -117,14 +117,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(
|
| @@ -141,16 +144,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,
|
| @@ -425,6 +430,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,
|
| @@ -478,6 +487,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;
|
|
|