| 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
|
|
|