Index: chromeos/network/shill_property_handler.cc |
diff --git a/chromeos/network/shill_property_handler.cc b/chromeos/network/shill_property_handler.cc |
index f15cb8548946916d544231b47d30b80ab44662b2..a6315c6df23e89ab794d33d1730dd729c43638ff 100644 |
--- a/chromeos/network/shill_property_handler.cc |
+++ b/chromeos/network/shill_property_handler.cc |
@@ -131,6 +131,11 @@ bool ShillPropertyHandler::TechnologyEnabled( |
return enabled_technologies_.count(technology) != 0; |
} |
+bool ShillPropertyHandler::TechnologyEnabling( |
+ const std::string& technology) const { |
+ return enabling_technologies_.count(technology) != 0; |
+} |
+ |
bool ShillPropertyHandler::TechnologyUninitialized( |
const std::string& technology) const { |
return uninitialized_technologies_.count(technology) != 0; |
@@ -141,12 +146,16 @@ void ShillPropertyHandler::SetTechnologyEnabled( |
bool enabled, |
const network_handler::ErrorCallback& error_callback) { |
if (enabled) { |
+ enabling_technologies_.insert(technology); |
shill_manager_->EnableTechnology( |
technology, |
base::Bind(&base::DoNothing), |
- base::Bind(&network_handler::ShillErrorCallbackFunction, |
- kLogModule, technology, error_callback)); |
+ base::Bind(&ShillPropertyHandler::EnableTechnologyFailed, |
+ AsWeakPtr(), technology, error_callback)); |
} else { |
+ // Imediately clear locally from enabled and enabling lists. |
+ enabled_technologies_.erase(technology); |
+ enabling_technologies_.erase(technology); |
shill_manager_->DisableTechnology( |
technology, |
base::Bind(&base::DoNothing), |
@@ -349,6 +358,7 @@ void ShillPropertyHandler::UpdateEnabledTechnologies( |
(*iter)->GetAsString(&technology); |
DCHECK(!technology.empty()); |
enabled_technologies_.insert(technology); |
+ enabling_technologies_.erase(technology); |
} |
} |
@@ -367,6 +377,16 @@ void ShillPropertyHandler::UpdateUninitializedTechnologies( |
} |
} |
+void ShillPropertyHandler::EnableTechnologyFailed( |
+ const std::string& technology, |
+ const network_handler::ErrorCallback& error_callback, |
+ const std::string& error_name, |
+ const std::string& error_message) { |
+ enabling_technologies_.erase(technology); |
+ network_handler::ShillErrorCallbackFunction( |
+ kLogModule, technology, error_callback, error_name, error_message); |
+} |
+ |
void ShillPropertyHandler::GetPropertiesCallback( |
ManagedState::ManagedType type, |
const std::string& path, |