| Index: chromeos/network/network_state.cc
|
| diff --git a/chromeos/network/network_state.cc b/chromeos/network/network_state.cc
|
| index 2dbb0a5f85d7b3249b91f7f09ff2d5dd68d93b1b..b5a02e1d60f58d6c2fcabc8372508c23a12a28b1 100644
|
| --- a/chromeos/network/network_state.cc
|
| +++ b/chromeos/network/network_state.cc
|
| @@ -13,7 +13,6 @@
|
| #include "base/strings/utf_string_conversion_utils.h"
|
| #include "chromeos/network/network_event_log.h"
|
| #include "chromeos/network/network_profile_handler.h"
|
| -#include "chromeos/network/network_ui_data.h"
|
| #include "chromeos/network/network_util.h"
|
| #include "chromeos/network/onc/onc_utils.h"
|
| #include "third_party/cros_system_api/dbus/service_constants.h"
|
| @@ -51,23 +50,6 @@ std::string ValidateUTF8(const std::string& str) {
|
| return result;
|
| }
|
|
|
| -// Returns a new NetworkUIData* if |ui_data_value| is a valid NetworkUIData
|
| -// dictionary string, otherwise returns NULL.
|
| -chromeos::NetworkUIData* CreateUIDataFromValue(
|
| - const base::Value& ui_data_value) {
|
| - std::string ui_data_str;
|
| - if (!ui_data_value.GetAsString(&ui_data_str))
|
| - return NULL;
|
| - if (ui_data_str.empty())
|
| - return new chromeos::NetworkUIData();
|
| -
|
| - scoped_ptr<base::DictionaryValue> ui_data_dict(
|
| - chromeos::onc::ReadDictionaryFromJson(ui_data_str));
|
| - if (!ui_data_dict)
|
| - return NULL;
|
| - return new chromeos::NetworkUIData(*ui_data_dict);
|
| -}
|
| -
|
| } // namespace
|
|
|
| namespace chromeos {
|
| @@ -77,7 +59,6 @@ NetworkState::NetworkState(const std::string& path)
|
| auto_connect_(false),
|
| favorite_(false),
|
| priority_(0),
|
| - onc_source_(onc::ONC_SOURCE_NONE),
|
| prefix_length_(0),
|
| signal_strength_(0),
|
| connectable_(false),
|
| @@ -152,7 +133,7 @@ bool NetworkState::PropertyChanged(const std::string& key,
|
| }
|
| return true;
|
| } else if (key == flimflam::kUIDataProperty) {
|
| - if (!GetOncSource(value, &onc_source_)) {
|
| + if (!GetUIDataFromValue(value, &ui_data_)) {
|
| NET_LOG_ERROR("Failed to parse " + key, path());
|
| return false;
|
| }
|
| @@ -279,8 +260,8 @@ bool NetworkState::IsConnectingState() const {
|
| }
|
|
|
| bool NetworkState::IsManaged() const {
|
| - return onc_source_ == onc::ONC_SOURCE_DEVICE_POLICY ||
|
| - onc_source_ == onc::ONC_SOURCE_USER_POLICY;
|
| + return ui_data_.onc_source() == onc::ONC_SOURCE_DEVICE_POLICY ||
|
| + ui_data_.onc_source() == onc::ONC_SOURCE_USER_POLICY;
|
| }
|
|
|
| bool NetworkState::IsPrivate() const {
|
| @@ -395,12 +376,20 @@ std::string NetworkState::IPConfigProperty(const char* key) {
|
| }
|
|
|
| // static
|
| -bool NetworkState::GetOncSource(const base::Value& ui_data_value,
|
| - onc::ONCSource* out) {
|
| - scoped_ptr<NetworkUIData> ui_data(CreateUIDataFromValue(ui_data_value));
|
| - if (!ui_data)
|
| +bool NetworkState::GetUIDataFromValue(const base::Value& ui_data_value,
|
| + NetworkUIData* out) {
|
| + std::string ui_data_str;
|
| + if (!ui_data_value.GetAsString(&ui_data_str))
|
| + return false;
|
| + if (ui_data_str.empty()) {
|
| + *out = NetworkUIData();
|
| + return true;
|
| + }
|
| + scoped_ptr<base::DictionaryValue> ui_data_dict(
|
| + chromeos::onc::ReadDictionaryFromJson(ui_data_str));
|
| + if (!ui_data_dict)
|
| return false;
|
| - *out = ui_data->onc_source();
|
| + *out = NetworkUIData(*ui_data_dict);
|
| return true;
|
| }
|
|
|
|
|