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

Unified Diff: chromeos/network/shill_property_handler.cc

Issue 14137017: Add TechnologyState to NetworkStateHandler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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/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,
« chromeos/network/shill_property_handler.h ('K') | « chromeos/network/shill_property_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698