Index: chromeos/network/network_util.cc |
diff --git a/chromeos/network/network_util.cc b/chromeos/network/network_util.cc |
index 1acf6e584c5b296a37dc6d6a8742a26aa4496e3b..f0d5d6a1f950dc4548c6d85e9fc5ec205052d82a 100644 |
--- a/chromeos/network/network_util.cc |
+++ b/chromeos/network/network_util.cc |
@@ -6,6 +6,11 @@ |
#include "base/strings/string_tokenizer.h" |
#include "base/strings/stringprintf.h" |
+#include "chromeos/network/network_state.h" |
+#include "chromeos/network/network_state_handler.h" |
+#include "chromeos/network/onc/onc_signature.h" |
+#include "chromeos/network/onc/onc_translator.h" |
+#include "chromeos/network/shill_property_util.h" |
#include "third_party/cros_system_api/dbus/service_constants.h" |
namespace chromeos { |
@@ -122,5 +127,27 @@ bool ParseCellularScanResults(const base::ListValue& list, |
return true; |
} |
+scoped_ptr<base::ListValue> TranslateNetworkListToONC( |
+ NetworkTypePattern pattern) { |
+ NetworkStateHandler::NetworkStateList network_states; |
+ NetworkHandler::Get()->network_state_handler()->GetNetworkListByType( |
+ pattern, &network_states); |
+ |
+ scoped_ptr<base::ListValue> network_properties_list(new base::ListValue); |
+ for (NetworkStateHandler::NetworkStateList::iterator it = |
+ network_states.begin(); |
+ it != network_states.end(); |
+ ++it) { |
+ base::DictionaryValue shill_dictionary; |
+ (*it)->GetStateProperties(&shill_dictionary); |
+ |
+ scoped_ptr<base::DictionaryValue> onc_network_part = |
+ TranslateShillServiceToONCPart( |
+ shill_dictionary, &onc::kNetworkWithStateSignature); |
+ network_properties_list->Append(onc_network_part.release()); |
+ } |
+ return network_properties_list.Pass(); |
+} |
+ |
} // namespace network_util |
} // namespace chromeos |