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

Unified Diff: chromeos/network/network_util.cc

Issue 19509002: Add support for Device.ProposeScan to NetworkDeviceHandler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed gauravsh@'s comments. Created 7 years, 5 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
« no previous file with comments | « chromeos/network/network_util.h ('k') | chromeos/network/network_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/network/network_util.cc
diff --git a/chromeos/network/network_util.cc b/chromeos/network/network_util.cc
index 299eb9f9bae5cfde49eaf3e692ddf84304a97806..70198ba340776966c5c11b19fc94d5e2b8eb0f78 100644
--- a/chromeos/network/network_util.cc
+++ b/chromeos/network/network_util.cc
@@ -6,6 +6,7 @@
#include "base/strings/string_tokenizer.h"
#include "base/strings/stringprintf.h"
+#include "third_party/cros_system_api/dbus/service_constants.h"
namespace chromeos {
@@ -24,6 +25,12 @@ WifiAccessPoint::WifiAccessPoint()
WifiAccessPoint::~WifiAccessPoint() {
}
+CellularScanResult::CellularScanResult() {
+}
+
+CellularScanResult::~CellularScanResult() {
+}
+
namespace network_util {
std::string PrefixLengthToNetmask(int32 prefix_length) {
@@ -92,5 +99,32 @@ int32 NetmaskToPrefixLength(const std::string& netmask) {
return prefix_length;
}
+bool ParseCellularScanResults(
+ const ListValue& list, std::vector<CellularScanResult>* scan_results) {
+ scan_results->clear();
+ scan_results->reserve(list.GetSize());
+ for (ListValue::const_iterator it = list.begin(); it != list.end(); ++it) {
+ if (!(*it)->IsType(base::Value::TYPE_DICTIONARY))
+ return false;
+ CellularScanResult scan_result;
+ const DictionaryValue* dict = static_cast<const DictionaryValue*>(*it);
+ // If the network id property is not present then this network cannot be
+ // connected to so don't include it in the results.
+ if (!dict->GetStringWithoutPathExpansion(flimflam::kNetworkIdProperty,
+ &scan_result.network_id))
+ continue;
+ dict->GetStringWithoutPathExpansion(flimflam::kStatusProperty,
+ &scan_result.status);
+ dict->GetStringWithoutPathExpansion(flimflam::kLongNameProperty,
+ &scan_result.long_name);
+ dict->GetStringWithoutPathExpansion(flimflam::kShortNameProperty,
+ &scan_result.short_name);
+ dict->GetStringWithoutPathExpansion(flimflam::kTechnologyProperty,
+ &scan_result.technology);
+ scan_results->push_back(scan_result);
+ }
+ return true;
+}
+
} // namespace network_util
} // namespace chromeos
« no previous file with comments | « chromeos/network/network_util.h ('k') | chromeos/network/network_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698