Chromium Code Reviews| Index: chromeos/network/network_state.cc |
| diff --git a/chromeos/network/network_state.cc b/chromeos/network/network_state.cc |
| index bbe698aac0628b07074e8cc4d3782e780a9fbcc5..fc9decfa75b1f44404547bda55f89bd0849cbfbf 100644 |
| --- a/chromeos/network/network_state.cc |
| +++ b/chromeos/network/network_state.cc |
| @@ -5,6 +5,8 @@ |
| #include "chromeos/network/network_state.h" |
| #include "base/values.h" |
| +#include "chromeos/network/onc/onc_signature.h" |
| +#include "chromeos/network/onc/onc_translator.h" |
| #include "third_party/cros_system_api/dbus/service_constants.h" |
| namespace chromeos { |
| @@ -51,6 +53,34 @@ bool NetworkState::IsConnectingState() const { |
| return StateIsConnecting(connection_state_); |
| } |
| +scoped_ptr<base::DictionaryValue> NetworkState::TranslateToONC() const { |
| + base::DictionaryValue shill_dictionary; |
| + shill_dictionary.SetStringWithoutPathExpansion(flimflam::kNameProperty, |
| + name()); |
| + shill_dictionary.SetStringWithoutPathExpansion(flimflam::kTypeProperty, |
| + type()); |
| + shill_dictionary.SetStringWithoutPathExpansion(flimflam::kSecurityProperty, |
| + security()); |
| + shill_dictionary.SetStringWithoutPathExpansion( |
| + flimflam::kNetworkTechnologyProperty, |
| + technology()); |
| + shill_dictionary.SetStringWithoutPathExpansion(flimflam::kStateProperty, |
| + connection_state()); |
| + shill_dictionary.SetStringWithoutPathExpansion( |
| + flimflam::kActivationStateProperty, |
| + activation_state()); |
| + shill_dictionary.SetStringWithoutPathExpansion( |
| + flimflam::kRoamingStateProperty, |
| + roaming()); |
| + shill_dictionary.SetIntegerWithoutPathExpansion( |
| + flimflam::kSignalStrengthProperty, |
| + signal_strength()); |
|
stevenjb
2013/03/04 18:57:58
Alternately, the above code doesn't actually depen
pneubeck (no reviews)
2013/03/05 13:11:55
Added such an inverse function. Changed the order
|
| + |
| + return onc::TranslateShillServiceToONCPart( |
| + shill_dictionary, |
| + &onc::kNetworkWithStateSignature).Pass(); |
| +} |
| + |
| // static |
| bool NetworkState::StateIsConnected(const std::string& connection_state) { |
| return (connection_state == flimflam::kStateReady || |