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

Unified Diff: chromeos/network/network_state.cc

Issue 17094011: Include WiFi.FrequencyList in NetworkState (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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_state.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/network/network_state.cc
diff --git a/chromeos/network/network_state.cc b/chromeos/network/network_state.cc
index 5a8914cec2a8582c6abcafd69cdeaa4689dfd16a..337b5240b56d2a3ec50aa57a3fa357b417bdc9ad 100644
--- a/chromeos/network/network_state.cc
+++ b/chromeos/network/network_state.cc
@@ -6,6 +6,7 @@
#include "base/i18n/icu_encoding_detection.h"
#include "base/i18n/icu_string_conversions.h"
+#include "base/json/json_writer.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
@@ -15,6 +16,9 @@
#include "chromeos/network/onc/onc_utils.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
+// TODO(stevenjb): Use flimflam:: property when defined in service_constants.h
+const char kWifiFrequencyListProperty[] = "WiFi.FrequencyList";
stevenjb 2013/06/20 20:19:30 This will be removed before comitting
+
namespace {
bool ConvertListValueToStringVector(const base::ListValue& string_list,
@@ -81,6 +85,24 @@ bool NetworkState::PropertyChanged(const std::string& key,
return GetBooleanValue(key, value, &connectable_);
} else if (key == flimflam::kPassphraseRequiredProperty) {
return GetBooleanValue(key, value, &passphrase_required_);
+ } else if (key == kWifiFrequencyListProperty) {
+ const base::ListValue* frequencies;
+ if (!value.GetAsList(&frequencies)) {
+ NET_LOG_ERROR("Failed to parse " + key, path());
+ return false;
+ }
+ wifi_frequencies_.clear();
+ for (base::ListValue::const_iterator iter = frequencies->begin();
+ iter != frequencies->end(); ++iter) {
+ int frequency;
+ if ((*iter)->GetAsInteger(&frequency))
+ wifi_frequencies_.push_back(frequency);
+ }
+ if (!wifi_frequencies_.empty()) {
+ std::string str;
+ base::JSONWriter::Write(frequencies, &str);
+ NET_LOG_DEBUG("WifiFrequencies for " + path(), str);
+ }
} else if (key == flimflam::kErrorProperty) {
return GetStringValue(key, value, &error_);
} else if (key == shill::kErrorDetailsProperty) {
@@ -108,7 +130,7 @@ bool NetworkState::PropertyChanged(const std::string& key,
} else if (key == flimflam::kProxyConfigProperty) {
std::string proxy_config_str;
if (!value.GetAsString(&proxy_config_str)) {
- LOG(WARNING) << "Failed to parse string value for:" << key;
+ NET_LOG_ERROR("Failed to parse " + key, path());
return false;
}
@@ -125,13 +147,13 @@ bool NetworkState::PropertyChanged(const std::string& key,
// order leads to memory access errors.
proxy_config_.MergeDictionary(proxy_config_dict.get());
} else {
- LOG(WARNING) << "Failed to parse dictionary value for: " << key;
+ NET_LOG_ERROR("Failed to parse " + key, path());
}
return true;
} else if (key == flimflam::kUIDataProperty) {
std::string ui_data_str;
if (!value.GetAsString(&ui_data_str)) {
- LOG(WARNING) << "Failed to parse string value for:" << key;
+ NET_LOG_ERROR("Failed to parse " + key, path());
return false;
}
@@ -144,7 +166,7 @@ bool NetworkState::PropertyChanged(const std::string& key,
if (ui_data_dict)
onc_source_ = NetworkUIData(*ui_data_dict).onc_source();
else
- LOG(WARNING) << "Failed to parse dictionary value for: " << key;
+ NET_LOG_ERROR("Failed to parse " + key, path());
return true;
} else if (key == flimflam::kNetworkTechnologyProperty) {
return GetStringValue(key, value, &technology_);
@@ -186,6 +208,14 @@ void NetworkState::GetProperties(base::DictionaryValue* dictionary) const {
connectable_);
dictionary->SetBooleanWithoutPathExpansion(
flimflam::kPassphraseRequiredProperty, passphrase_required_);
+
+ base::ListValue* frequencies = new base::ListValue;
+ for (FrequencyList::const_iterator iter = wifi_frequencies_.begin();
+ iter != wifi_frequencies_.end(); ++iter) {
+ frequencies->AppendInteger(*iter);
+ }
+ dictionary->SetWithoutPathExpansion(kWifiFrequencyListProperty, frequencies);
+
dictionary->SetStringWithoutPathExpansion(flimflam::kErrorProperty,
error_);
dictionary->SetStringWithoutPathExpansion(shill::kErrorDetailsProperty,
« no previous file with comments | « chromeos/network/network_state.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698