| 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 "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "chromeos/chromeos_export.h" | 9 #include "chromeos/chromeos_export.h" |
| 10 #include "components/onc/onc_constants.h" | 10 #include "components/onc/onc_constants.h" |
| 11 | 11 |
| 12 namespace base { | 12 namespace base { |
| 13 class DictionaryValue; | 13 class DictionaryValue; |
| 14 } | 14 } |
| 15 | 15 |
| 16 namespace chromeos { | 16 namespace chromeos { |
| 17 | |
| 18 class NetworkState; | |
| 19 | |
| 20 namespace onc { | 17 namespace onc { |
| 21 | 18 |
| 22 struct OncValueSignature; | 19 struct OncValueSignature; |
| 23 | 20 |
| 24 // Translates a hierarchical ONC dictionary |onc_object| to a flat Shill | 21 // Translates a hierarchical ONC dictionary |onc_object| to a flat Shill |
| 25 // dictionary. The |signature| declares the type of |onc_object| and must point | 22 // dictionary. The |signature| declares the type of |onc_object| and must point |
| 26 // to one of the signature objects in "onc_signature.h". The resulting Shill | 23 // to one of the signature objects in "onc_signature.h". The resulting Shill |
| 27 // dictionary is returned. | 24 // dictionary is returned. |
| 28 // | 25 // |
| 29 // This function is used to translate network settings from ONC to Shill's | 26 // This function is used to translate network settings from ONC to Shill's |
| 30 // format before sending them to Shill. | 27 // format before sending them to Shill. |
| 31 CHROMEOS_EXPORT | 28 CHROMEOS_EXPORT |
| 32 scoped_ptr<base::DictionaryValue> TranslateONCObjectToShill( | 29 scoped_ptr<base::DictionaryValue> TranslateONCObjectToShill( |
| 33 const OncValueSignature* signature, | 30 const OncValueSignature* signature, |
| 34 const base::DictionaryValue& onc_object); | 31 const base::DictionaryValue& onc_object); |
| 35 | 32 |
| 36 // Translates a |shill_dictionary| to an ONC object according to the given | 33 // Translates a |shill_dictionary| to an ONC object according to the given |
| 37 // |onc_signature|. |onc_signature| must point to a signature object in | 34 // |onc_signature|. |onc_signature| must point to a signature object in |
| 38 // "onc_signature.h". The resulting ONC object is returned. | 35 // "onc_signature.h". The resulting ONC object is returned. |
| 39 // | 36 // |
| 40 // This function is used to translate network settings coming from Shill to ONC | 37 // This function is used to translate network settings coming from Shill to ONC |
| 41 // before sending them to the UI. The result doesn't have to be valid ONC, but | 38 // before sending them to the UI. The result doesn't have to be valid ONC, but |
| 42 // only a subset of it and includes only the values that are actually required | 39 // only a subset of it and includes only the values that are actually required |
| 43 // by the UI. If |onc_source| != ONC_SOURCE_UNKNOWN then the 'Source' property | 40 // by the UI. If |onc_source| != ONC_SOURCE_UNKNOWN then the 'Source' property |
| 44 // of the ONC dictionary will be set accordingly. Note: ONC_SOURCE_USER_IMPORT | 41 // of the ONC dictionary will be set accordingly. Note: ONC_SOURCE_USER_IMPORT |
| 45 // is treated the same as ONC_SOURCE_NONE. If |network_state| is provided it | 42 // is treated the same as ONC_SOURCE_NONE. |
| 46 // will be used to set the ErrorState property. Otherwise ErrorState will not | |
| 47 // be set. | |
| 48 CHROMEOS_EXPORT | 43 CHROMEOS_EXPORT |
| 49 scoped_ptr<base::DictionaryValue> TranslateShillServiceToONCPart( | 44 scoped_ptr<base::DictionaryValue> TranslateShillServiceToONCPart( |
| 50 const base::DictionaryValue& shill_dictionary, | 45 const base::DictionaryValue& shill_dictionary, |
| 51 ::onc::ONCSource onc_source, | 46 ::onc::ONCSource onc_source, |
| 52 const OncValueSignature* onc_signature, | 47 const OncValueSignature* onc_signature); |
| 53 const NetworkState* network_state); | |
| 54 | 48 |
| 55 } // namespace onc | 49 } // namespace onc |
| 56 } // namespace chromeos | 50 } // namespace chromeos |
| 57 | 51 |
| 58 #endif // CHROMEOS_NETWORK_ONC_ONC_TRANSLATOR_H_ | 52 #endif // CHROMEOS_NETWORK_ONC_ONC_TRANSLATOR_H_ |
| OLD | NEW |