Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Unified Diff: chromeos/network/onc/onc_utils.h

Issue 11664005: Extending the translation from ONC to Shill. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebased. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/network/onc/onc_translator_unittest.cc ('k') | chromeos/network/onc/onc_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/network/onc/onc_utils.h
diff --git a/chromeos/network/onc/onc_utils.h b/chromeos/network/onc/onc_utils.h
index 13263a826ae442efaa4470b3f31f212b904b4820..61ab3a4f30f76a3373021d0e3a78f432ab9402b7 100644
--- a/chromeos/network/onc/onc_utils.h
+++ b/chromeos/network/onc/onc_utils.h
@@ -7,9 +7,11 @@
#include <string>
+#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "chromeos/chromeos_export.h"
#include "chromeos/network/onc/onc_constants.h"
+#include "chromeos/network/onc/onc_signature.h"
namespace base {
class DictionaryValue;
@@ -28,7 +30,7 @@ CHROMEOS_EXPORT extern const char kEmptyUnencryptedConfiguration[];
CHROMEOS_EXPORT scoped_ptr<base::DictionaryValue> ReadDictionaryFromJson(
const std::string& json);
-// Decrypt the given EncryptedConfiguration |onc| (see the ONC specification)
+// Decrypts the given EncryptedConfiguration |onc| (see the ONC specification)
// using |passphrase|. The resulting UnencryptedConfiguration is returned. If an
// error occurs, returns NULL.
CHROMEOS_EXPORT scoped_ptr<base::DictionaryValue> Decrypt(
@@ -38,7 +40,31 @@ CHROMEOS_EXPORT scoped_ptr<base::DictionaryValue> Decrypt(
// For logging only: strings not user facing.
CHROMEOS_EXPORT std::string GetSourceAsString(ONCSource source);
-} // chromeos
-} // onc
+// Used for string expansion with function ExpandStringInOncObject(...).
+class CHROMEOS_EXPORT StringSubstitution {
+ public:
+ StringSubstitution() {}
+ virtual ~StringSubstitution() {}
+
+ // Returns the replacement string for |placeholder| in
+ // |substitute|. Currently, onc::substitutes::kLoginIDField and
+ // onc::substitutes::kEmailField are supported.
+ virtual bool GetSubstitute(std::string placeholder,
+ std::string* substitute) const = 0;
+ private:
+ DISALLOW_COPY_AND_ASSIGN(StringSubstitution);
+};
+
+// Replaces all expandable fields that are mentioned in the ONC
+// specification. The object of |onc_object| is modified in place. Currently
+// onc::substitutes::kLoginIDField and onc::substitutes::kEmailField are
+// expanded. The replacement strings are obtained from |substitution|.
+CHROMEOS_EXPORT void ExpandStringsInOncObject(
+ const OncValueSignature& signature,
+ const StringSubstitution& substitution,
+ base::DictionaryValue* onc_object);
+
+} // namespace onc
+} // namespace chromeos
#endif // CHROMEOS_NETWORK_ONC_ONC_UTILS_H_
« no previous file with comments | « chromeos/network/onc/onc_translator_unittest.cc ('k') | chromeos/network/onc/onc_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698