OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chromeos/network/network_ui_data.h" | 5 #include "chromeos/network/network_ui_data.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chromeos/network/onc/onc_signature.h" | 9 #include "chromeos/network/onc/onc_signature.h" |
10 | 10 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 NetworkUIData& NetworkUIData::operator=(const NetworkUIData& other) { | 76 NetworkUIData& NetworkUIData::operator=(const NetworkUIData& other) { |
77 certificate_pattern_ = other.certificate_pattern_; | 77 certificate_pattern_ = other.certificate_pattern_; |
78 onc_source_ = other.onc_source_; | 78 onc_source_ = other.onc_source_; |
79 certificate_type_ = other.certificate_type_; | 79 certificate_type_ = other.certificate_type_; |
80 if (other.user_settings_) | 80 if (other.user_settings_) |
81 user_settings_.reset(other.user_settings_->DeepCopy()); | 81 user_settings_.reset(other.user_settings_->DeepCopy()); |
82 policy_guid_ = other.policy_guid_; | 82 policy_guid_ = other.policy_guid_; |
83 return *this; | 83 return *this; |
84 } | 84 } |
85 | 85 |
86 NetworkUIData::NetworkUIData(const DictionaryValue& dict) { | 86 NetworkUIData::NetworkUIData(const base::DictionaryValue& dict) { |
87 std::string source; | 87 std::string source; |
88 dict.GetString(kKeyONCSource, &source); | 88 dict.GetString(kKeyONCSource, &source); |
89 onc_source_ = StringToEnum(kONCSourceTable, source, onc::ONC_SOURCE_NONE); | 89 onc_source_ = StringToEnum(kONCSourceTable, source, onc::ONC_SOURCE_NONE); |
90 | 90 |
91 std::string type_string; | 91 std::string type_string; |
92 dict.GetString(kKeyCertificateType, &type_string); | 92 dict.GetString(kKeyCertificateType, &type_string); |
93 certificate_type_ = | 93 certificate_type_ = |
94 StringToEnum(kClientCertTable, type_string, CLIENT_CERT_TYPE_NONE); | 94 StringToEnum(kClientCertTable, type_string, CLIENT_CERT_TYPE_NONE); |
95 | 95 |
96 if (certificate_type_ == CLIENT_CERT_TYPE_PATTERN) { | 96 if (certificate_type_ == CLIENT_CERT_TYPE_PATTERN) { |
97 const DictionaryValue* cert_dict = NULL; | 97 const base::DictionaryValue* cert_dict = NULL; |
98 dict.GetDictionary(kKeyCertificatePattern, &cert_dict); | 98 dict.GetDictionary(kKeyCertificatePattern, &cert_dict); |
99 if (cert_dict) | 99 if (cert_dict) |
100 certificate_pattern_.CopyFromDictionary(*cert_dict); | 100 certificate_pattern_.CopyFromDictionary(*cert_dict); |
101 if (certificate_pattern_.Empty()) { | 101 if (certificate_pattern_.Empty()) { |
102 LOG(ERROR) << "Couldn't parse a valid certificate pattern."; | 102 LOG(ERROR) << "Couldn't parse a valid certificate pattern."; |
103 certificate_type_ = CLIENT_CERT_TYPE_NONE; | 103 certificate_type_ = CLIENT_CERT_TYPE_NONE; |
104 } | 104 } |
105 } | 105 } |
106 | 106 |
107 const DictionaryValue* user_settings = NULL; | 107 const base::DictionaryValue* user_settings = NULL; |
108 if (dict.GetDictionary(kKeyUserSettings, &user_settings)) | 108 if (dict.GetDictionary(kKeyUserSettings, &user_settings)) |
109 user_settings_.reset(user_settings->DeepCopy()); | 109 user_settings_.reset(user_settings->DeepCopy()); |
110 } | 110 } |
111 | 111 |
112 NetworkUIData::~NetworkUIData() { | 112 NetworkUIData::~NetworkUIData() { |
113 } | 113 } |
114 | 114 |
115 void NetworkUIData::FillDictionary(base::DictionaryValue* dict) const { | 115 void NetworkUIData::FillDictionary(base::DictionaryValue* dict) const { |
116 dict->Clear(); | 116 dict->Clear(); |
117 | 117 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 scoped_ptr<NetworkUIData> ui_data(new NetworkUIData()); | 225 scoped_ptr<NetworkUIData> ui_data(new NetworkUIData()); |
226 TranslateONCHierarchy(onc::kNetworkConfigurationSignature, onc_network, | 226 TranslateONCHierarchy(onc::kNetworkConfigurationSignature, onc_network, |
227 ui_data.get()); | 227 ui_data.get()); |
228 | 228 |
229 ui_data->set_onc_source(onc_source); | 229 ui_data->set_onc_source(onc_source); |
230 | 230 |
231 return ui_data.Pass(); | 231 return ui_data.Pass(); |
232 } | 232 } |
233 | 233 |
234 } // namespace chromeos | 234 } // namespace chromeos |
OLD | NEW |