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

Unified Diff: chromeos/network/network_state.cc

Issue 12319145: Using the new Network*Handlers in networkingPrivate Extension API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Initial patch. Created 7 years, 10 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/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());
+
+ return onc::TranslateShillServiceToONCPart(
+ shill_dictionary,
+ &onc::kNetworkWithStateSignature).Pass();
+}
+
// static
bool NetworkState::StateIsConnected(const std::string& connection_state) {
return (connection_state == flimflam::kStateReady ||

Powered by Google App Engine
This is Rietveld 408576698