| 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/onc/onc_translator.h" | 5 #include "chromeos/network/onc/onc_translator.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 } | 195 } |
| 196 | 196 |
| 197 void ShillToONCTranslator::TranslateAndAddNestedObject( | 197 void ShillToONCTranslator::TranslateAndAddNestedObject( |
| 198 const std::string& onc_field_name) { | 198 const std::string& onc_field_name) { |
| 199 const OncFieldSignature* field_signature = | 199 const OncFieldSignature* field_signature = |
| 200 GetFieldSignature(*onc_signature_, onc_field_name); | 200 GetFieldSignature(*onc_signature_, onc_field_name); |
| 201 ShillToONCTranslator nested_translator(*shill_dictionary_, | 201 ShillToONCTranslator nested_translator(*shill_dictionary_, |
| 202 *field_signature->value_signature); | 202 *field_signature->value_signature); |
| 203 scoped_ptr<base::DictionaryValue> nested_object = | 203 scoped_ptr<base::DictionaryValue> nested_object = |
| 204 nested_translator.CreateTranslatedONCObject(); | 204 nested_translator.CreateTranslatedONCObject(); |
| 205 if (nested_object->empty()) |
| 206 return; |
| 205 onc_object_->SetWithoutPathExpansion(onc_field_name, nested_object.release()); | 207 onc_object_->SetWithoutPathExpansion(onc_field_name, nested_object.release()); |
| 206 } | 208 } |
| 207 | 209 |
| 208 void ShillToONCTranslator::TranslateNetworkWithState() { | 210 void ShillToONCTranslator::TranslateNetworkWithState() { |
| 209 TranslateWithTableAndSet(flimflam::kTypeProperty, kNetworkTypeTable, | 211 TranslateWithTableAndSet(flimflam::kTypeProperty, kNetworkTypeTable, |
| 210 network_config::kType); | 212 network_config::kType); |
| 211 CopyPropertiesAccordingToSignature(); | 213 CopyPropertiesAccordingToSignature(); |
| 212 | 214 |
| 213 std::string network_type; | 215 std::string network_type; |
| 214 if (onc_object_->GetStringWithoutPathExpansion(network_config::kType, | 216 if (onc_object_->GetStringWithoutPathExpansion(network_config::kType, |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 const base::DictionaryValue& shill_dictionary, | 304 const base::DictionaryValue& shill_dictionary, |
| 303 const OncValueSignature* onc_signature) { | 305 const OncValueSignature* onc_signature) { |
| 304 CHECK(onc_signature != NULL); | 306 CHECK(onc_signature != NULL); |
| 305 | 307 |
| 306 ShillToONCTranslator translator(shill_dictionary, *onc_signature); | 308 ShillToONCTranslator translator(shill_dictionary, *onc_signature); |
| 307 return translator.CreateTranslatedONCObject(); | 309 return translator.CreateTranslatedONCObject(); |
| 308 } | 310 } |
| 309 | 311 |
| 310 } // namespace onc | 312 } // namespace onc |
| 311 } // namespace chromeos | 313 } // namespace chromeos |
| OLD | NEW |