| 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 #ifndef CHROMEOS_NETWORK_ONC_ONC_TRANSLATOR_H_ | 5 #ifndef CHROMEOS_NETWORK_ONC_ONC_TRANSLATOR_H_ |
| 6 #define CHROMEOS_NETWORK_ONC_ONC_TRANSLATOR_H_ | 6 #define CHROMEOS_NETWORK_ONC_ONC_TRANSLATOR_H_ |
| 7 | 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 8 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 9 #include "chromeos/chromeos_export.h" | 12 #include "chromeos/chromeos_export.h" |
| 10 | 13 |
| 11 namespace base { | 14 namespace base { |
| 12 class DictionaryValue; | 15 class DictionaryValue; |
| 13 } | 16 } |
| 14 | 17 |
| 15 namespace chromeos { | 18 namespace chromeos { |
| 16 namespace onc { | 19 namespace onc { |
| 17 | 20 |
| 18 struct OncValueSignature; | 21 struct OncValueSignature; |
| 19 | 22 |
| 20 // Translates a hierarchical ONC dictionary |onc_object| to a flat Shill | 23 // Translates a hierarchical ONC dictionary |onc_object| to a flat Shill |
| 21 // dictionary. The |signature| declares the type of |onc_object| and must point | 24 // dictionary. The |signature| declares the type of |onc_object| and must point |
| 22 // to one of the signature objects in "onc_signature.h". The resulting Shill | 25 // to one of the signature objects in "onc_signature.h". The resulting Shill |
| 23 // dictionary is returned. | 26 // dictionary is returned. |
| 24 // | 27 // |
| 25 // This function is used to translate network settings from ONC to Shill's | 28 // This function is used to translate network settings from ONC to Shill's |
| 26 // format before sending them to Shill. | 29 // format before sending them to Shill. |
| 27 CHROMEOS_EXPORT | 30 CHROMEOS_EXPORT |
| 28 scoped_ptr<base::DictionaryValue> TranslateONCObjectToShill( | 31 scoped_ptr<base::DictionaryValue> TranslateONCObjectToShill( |
| 29 const OncValueSignature* signature, | 32 const base::DictionaryValue& onc_object, |
| 30 const base::DictionaryValue& onc_object); | 33 const OncValueSignature* signature); |
| 34 |
| 35 // Translates a list of ONC property names into corresponding Shill property |
| 36 // names. The ability to do this requires that ONC and Shill have a 1:1 mapping |
| 37 // between property names. |
| 38 std::vector<std::string> TranslateONCPropertyNamesToShill( |
| 39 const std::vector<std::string>& onc_names, |
| 40 const OncValueSignature* signature); |
| 31 | 41 |
| 32 // Translates a |shill_dictionary| to an ONC object according to the given | 42 // Translates a |shill_dictionary| to an ONC object according to the given |
| 33 // |onc_signature|. |onc_signature| must point to a signature object in | 43 // |onc_signature|. |onc_signature| must point to a signature object in |
| 34 // "onc_signature.h". The resulting ONC object is returned. | 44 // "onc_signature.h". The resulting ONC object is returned. |
| 35 // | 45 // |
| 36 // This function is used to translate network settings coming from Shill to ONC | 46 // This function is used to translate network settings coming from Shill to ONC |
| 37 // before sending them to the UI. The result doesn't have to be valid ONC, but | 47 // before sending them to the UI. The result doesn't have to be valid ONC, but |
| 38 // only a subset of it and includes only the values that are actually required | 48 // only a subset of it and includes only the values that are actually required |
| 39 // by the UI. | 49 // by the UI. |
| 40 CHROMEOS_EXPORT | 50 CHROMEOS_EXPORT |
| 41 scoped_ptr<base::DictionaryValue> TranslateShillServiceToONCPart( | 51 scoped_ptr<base::DictionaryValue> TranslateShillServiceToONCPart( |
| 42 const base::DictionaryValue& shill_dictionary, | 52 const base::DictionaryValue& shill_dictionary, |
| 43 const OncValueSignature* onc_signature); | 53 const OncValueSignature* onc_signature); |
| 44 | 54 |
| 55 |
| 56 // Translates a list of Shill property names into corresponding ONC property |
| 57 // names. The ability to do this requires that ONC and Shill have a 1:1 mapping |
| 58 // between property names. |
| 59 std::vector<std::string> TranslateShillPropertyNamesToONC( |
| 60 const std::vector<std::string>& shill_names, |
| 61 const OncValueSignature* signature); |
| 62 |
| 45 } // namespace onc | 63 } // namespace onc |
| 46 } // namespace chromeos | 64 } // namespace chromeos |
| 47 | 65 |
| 48 #endif // CHROMEOS_NETWORK_ONC_ONC_TRANSLATOR_H_ | 66 #endif // CHROMEOS_NETWORK_ONC_ONC_TRANSLATOR_H_ |
| OLD | NEW |