OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_POLICY_UTIL_H_ | 5 #ifndef CHROMEOS_NETWORK_POLICY_UTIL_H_ |
6 #define CHROMEOS_NETWORK_POLICY_UTIL_H_ | 6 #define CHROMEOS_NETWORK_POLICY_UTIL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 | |
13 namespace base { | 12 namespace base { |
14 class DictionaryValue; | 13 class DictionaryValue; |
15 } | 14 } |
16 | 15 |
17 namespace chromeos { | 16 namespace chromeos { |
18 | 17 |
19 struct NetworkProfile; | 18 struct NetworkProfile; |
20 | 19 |
21 namespace policy_util { | 20 namespace policy_util { |
22 | 21 |
23 typedef std::map<std::string, const base::DictionaryValue*> GuidToPolicyMap; | 22 using GuidToPolicyMap = |
| 23 std::map<std::string, std::unique_ptr<base::DictionaryValue>>; |
24 | 24 |
25 // Creates a managed ONC dictionary from the given arguments. Depending on the | 25 // Creates a managed ONC dictionary from the given arguments. Depending on the |
26 // profile type, the policies are assumed to come from the user or device policy | 26 // profile type, the policies are assumed to come from the user or device policy |
27 // and and |user_settings| to be the user's non-shared or shared settings. | 27 // and and |user_settings| to be the user's non-shared or shared settings. |
28 // Each of the arguments can be NULL. | 28 // Each of the arguments can be NULL. |
29 // TODO(pneubeck): Add documentation of the returned format, see | 29 // TODO(pneubeck): Add documentation of the returned format, see |
30 // https://crbug.com/408990 . | 30 // https://crbug.com/408990 . |
31 std::unique_ptr<base::DictionaryValue> CreateManagedONC( | 31 std::unique_ptr<base::DictionaryValue> CreateManagedONC( |
32 const base::DictionaryValue* global_policy, | 32 const base::DictionaryValue* global_policy, |
33 const base::DictionaryValue* network_policy, | 33 const base::DictionaryValue* network_policy, |
34 const base::DictionaryValue* user_settings, | 34 const base::DictionaryValue* user_settings, |
35 const base::DictionaryValue* active_settings, | 35 const base::DictionaryValue* active_settings, |
36 const NetworkProfile* profile); | 36 const NetworkProfile* profile); |
37 | 37 |
38 // Adds properties to |shill_properties_to_update|, which are enforced on an | 38 // Adds properties to |shill_properties_to_update|, which are enforced on an |
39 // unamaged network by the global config |global_network_policy| of the policy. | 39 // unmanaged network by the global config |global_network_policy| of the policy. |
40 // |shill_dictionary| are the network's current properties read from Shill. | 40 // |shill_dictionary| are the network's current properties read from Shill. |
41 void SetShillPropertiesForGlobalPolicy( | 41 void SetShillPropertiesForGlobalPolicy( |
42 const base::DictionaryValue& shill_dictionary, | 42 const base::DictionaryValue& shill_dictionary, |
43 const base::DictionaryValue& global_network_policy, | 43 const base::DictionaryValue& global_network_policy, |
44 base::DictionaryValue* shill_properties_to_update); | 44 base::DictionaryValue* shill_properties_to_update); |
45 | 45 |
46 // Creates a Shill property dictionary from the given arguments. The resulting | 46 // Creates a Shill property dictionary from the given arguments. The resulting |
47 // dictionary will be sent to Shill by the caller. Depending on the profile | 47 // dictionary will be sent to Shill by the caller. Depending on the profile |
48 // type, |network_policy| is interpreted as the user or device policy and | 48 // type, |network_policy| is interpreted as the user or device policy and |
49 // |user_settings| as the user or shared settings. |network_policy| or | 49 // |user_settings| as the user or shared settings. |network_policy| or |
(...skipping 10 matching lines...) Expand all Loading... |
60 // NetworkConfiguration. | 60 // NetworkConfiguration. |
61 const base::DictionaryValue* FindMatchingPolicy( | 61 const base::DictionaryValue* FindMatchingPolicy( |
62 const GuidToPolicyMap& policies, | 62 const GuidToPolicyMap& policies, |
63 const base::DictionaryValue& actual_network); | 63 const base::DictionaryValue& actual_network); |
64 | 64 |
65 } // namespace policy_util | 65 } // namespace policy_util |
66 | 66 |
67 } // namespace chromeos | 67 } // namespace chromeos |
68 | 68 |
69 #endif // CHROMEOS_NETWORK_POLICY_UTIL_H_ | 69 #endif // CHROMEOS_NETWORK_POLICY_UTIL_H_ |
OLD | NEW |