Index: chromeos/network/shill_property_handler.cc |
diff --git a/chromeos/network/shill_property_handler.cc b/chromeos/network/shill_property_handler.cc |
index fad1d754cf8dcefef95d92619f7971b2c19f5b0e..e6efd65920689a105bf81ded15f88d5fcdd28491 100644 |
--- a/chromeos/network/shill_property_handler.cc |
+++ b/chromeos/network/shill_property_handler.cc |
@@ -121,17 +121,22 @@ void ShillPropertyHandler::Init() { |
shill_manager_->AddPropertyChangedObserver(this); |
} |
-bool ShillPropertyHandler::TechnologyAvailable( |
+bool ShillPropertyHandler::IsTechnologyAvailable( |
const std::string& technology) const { |
return available_technologies_.count(technology) != 0; |
} |
-bool ShillPropertyHandler::TechnologyEnabled( |
+bool ShillPropertyHandler::IsTechnologyEnabled( |
const std::string& technology) const { |
return enabled_technologies_.count(technology) != 0; |
} |
-bool ShillPropertyHandler::TechnologyUninitialized( |
+bool ShillPropertyHandler::IsTechnologyEnabling( |
+ const std::string& technology) const { |
+ return enabling_technologies_.count(technology) != 0; |
+} |
+ |
+bool ShillPropertyHandler::IsTechnologyUninitialized( |
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), |
@@ -351,6 +360,7 @@ void ShillPropertyHandler::UpdateEnabledTechnologies( |
(*iter)->GetAsString(&technology); |
DCHECK(!technology.empty()); |
enabled_technologies_.insert(technology); |
+ enabling_technologies_.erase(technology); |
} |
} |
@@ -369,6 +379,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, |