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

Side by Side 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: Initial patch. Created 8 years 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 unified diff | Download patch
OLDNEW
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_UTILS_H_ 5 #ifndef CHROMEOS_NETWORK_ONC_ONC_UTILS_H_
6 #define CHROMEOS_NETWORK_ONC_ONC_UTILS_H_ 6 #define CHROMEOS_NETWORK_ONC_ONC_UTILS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h"
10 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
11 #include "chromeos/chromeos_export.h" 12 #include "chromeos/chromeos_export.h"
12 #include "chromeos/network/onc/onc_constants.h" 13 #include "chromeos/network/onc/onc_constants.h"
14 #include "chromeos/network/onc/onc_signature.h"
13 15
14 namespace base { 16 namespace base {
15 class DictionaryValue; 17 class DictionaryValue;
16 } 18 }
17 19
18 namespace chromeos { 20 namespace chromeos {
19 namespace onc { 21 namespace onc {
20 22
21 // A valid but empty (no networks and no certificates) and unencrypted 23 // A valid but empty (no networks and no certificates) and unencrypted
22 // configuration. 24 // configuration.
23 CHROMEOS_EXPORT extern const char kEmptyUnencryptedConfiguration[]; 25 CHROMEOS_EXPORT extern const char kEmptyUnencryptedConfiguration[];
24 26
25 // Parses |json| according to the JSON format. If |json| is a JSON formatted 27 // Parses |json| according to the JSON format. If |json| is a JSON formatted
26 // dictionary, the function returns the dictionary as a DictionaryValue. 28 // dictionary, the function returns the dictionary as a DictionaryValue.
27 // Otherwise returns NULL. 29 // Otherwise returns NULL.
28 CHROMEOS_EXPORT scoped_ptr<base::DictionaryValue> ReadDictionaryFromJson( 30 CHROMEOS_EXPORT scoped_ptr<base::DictionaryValue> ReadDictionaryFromJson(
29 const std::string& json); 31 const std::string& json);
30 32
31 // Decrypt the given EncryptedConfiguration |onc| (see the ONC specification) 33 // Decrypt the given EncryptedConfiguration |onc| (see the ONC specification)
32 // using |passphrase|. The resulting UnencryptedConfiguration is returned. If an 34 // using |passphrase|. The resulting UnencryptedConfiguration is returned. If an
33 // error occurs, returns NULL. 35 // error occurs, returns NULL.
34 CHROMEOS_EXPORT scoped_ptr<base::DictionaryValue> Decrypt( 36 CHROMEOS_EXPORT scoped_ptr<base::DictionaryValue> Decrypt(
35 const std::string& passphrase, 37 const std::string& passphrase,
36 const base::DictionaryValue& onc); 38 const base::DictionaryValue& onc);
37 39
38 // For logging only: strings not user facing. 40 // For logging only: strings not user facing.
39 CHROMEOS_EXPORT std::string GetSourceAsString(ONCSource source); 41 CHROMEOS_EXPORT std::string GetSourceAsString(ONCSource source);
40 42
43 class CHROMEOS_EXPORT StringSubstitution {
44 public:
45 StringSubstitution() {}
46 virtual bool GetSubstitute(std::string placeholder,
47 std::string* substitute) = 0;
48 private:
49 DISALLOW_COPY_AND_ASSIGN(StringSubstitution);
50 };
51
52 CHROMEOS_EXPORT void ExpandStringsInOncObject(
53 const OncValueSignature& signature,
54 StringSubstitution* substitution,
55 base::DictionaryValue* onc_object);
56
57 } // onc
41 } // chromeos 58 } // chromeos
42 } // onc
43 59
44 #endif // CHROMEOS_NETWORK_ONC_ONC_UTILS_H_ 60 #endif // CHROMEOS_NETWORK_ONC_ONC_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698