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

Unified Diff: chromeos/network/onc/onc_translator_shill_to_onc.cc

Issue 1043343002: Use networkingPrivate.startConnect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_430115_internet_options_cellular
Patch Set: Move ErrorState logic to ShillToONCTranslator Created 5 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/onc/onc_translator_shill_to_onc.cc
diff --git a/chromeos/network/onc/onc_translator_shill_to_onc.cc b/chromeos/network/onc/onc_translator_shill_to_onc.cc
index d918156dfffa41db1d929970196669690b4d00fa..6ea4d09e8e34e7d7ab4f0f7bacd1de16948d5d49 100644
--- a/chromeos/network/onc/onc_translator_shill_to_onc.cc
+++ b/chromeos/network/onc/onc_translator_shill_to_onc.cc
@@ -12,8 +12,10 @@
#include "base/logging.h"
#include "base/strings/string_util.h"
#include "base/values.h"
+#include "chromeos/network/network_handler.h"
#include "chromeos/network/network_profile_handler.h"
#include "chromeos/network/network_state.h"
+#include "chromeos/network/network_state_handler.h"
#include "chromeos/network/network_util.h"
#include "chromeos/network/onc/onc_signature.h"
#include "chromeos/network/onc/onc_translation_tables.h"
@@ -44,6 +46,14 @@ scoped_ptr<base::Value> ConvertStringToValue(const std::string& str,
return make_scoped_ptr(value);
}
+const NetworkState* GetNetworkStateFromGuid(const std::string& guid) {
+ if (!NetworkHandler::IsInitialized())
pneubeck (no reviews) 2015/04/14 09:32:16 This is not explicit though. If at all, please pas
+ return nullptr;
+ return NetworkHandler::Get()
+ ->network_state_handler()
+ ->GetNetworkStateFromGuid(guid);
+}
+
// This class implements the translation of properties from the given
// |shill_dictionary| to a new ONC object of signature |onc_signature|. Using
// recursive calls to CreateTranslatedONCObject of new instances, nested objects
@@ -474,6 +484,19 @@ void ShillToONCTranslator::TranslateNetworkWithState() {
}
}
+ // 'ErrorState' reflects the most recent error maintained in NetworkState
+ // (which may not match Shill's Error or PreviousError properties). Non
+ // visible networks (with no NetworkState) do not set ErrorState.
+ std::string guid;
+ if (shill_dictionary_->GetStringWithoutPathExpansion(shill::kGuidProperty,
+ &guid)) {
+ const NetworkState* network_state = GetNetworkStateFromGuid(guid);
+ if (network_state) {
+ onc_object_->SetStringWithoutPathExpansion(
+ ::onc::network_config::kErrorState, network_state->GetErrorState());
+ }
+ }
+
std::string profile_path;
if (onc_source_ != ::onc::ONC_SOURCE_UNKNOWN &&
shill_dictionary_->GetStringWithoutPathExpansion(shill::kProfileProperty,
« no previous file with comments | « chromeos/network/onc/onc_translation_tables.cc ('k') | components/device_event_log/device_event_log_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698