• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #ifndef CHROMEOS_NETWORK_ONC_ONC_MERGER_H_
6 #define CHROMEOS_NETWORK_ONC_ONC_MERGER_H_
7 
8 #include "base/memory/scoped_ptr.h"
9 #include "chromeos/chromeos_export.h"
10 
11 namespace base {
12 class DictionaryValue;
13 }
14 
15 namespace chromeos {
16 namespace onc {
17 
18 struct OncValueSignature;
19 
20 // Merges the given |user_settings| and |shared_settings| settings with the
21 // given |user_policy| and |device_policy| settings. Each can be omitted by
22 // providing a NULL pointer. Each dictionary has to be part of a valid ONC
23 // dictionary. They don't have to describe top-level ONC but should refer to the
24 // same section in ONC. |user_settings| and |shared_settings| should not contain
25 // kRecommended fields. The resulting dictionary is valid ONC but may contain
26 // dispensable fields (e.g. in a network with type: "WiFi", the field "VPN" is
27 // dispensable) that can be removed by the caller using the ONC normalizer. ONC
28 // conformance of the arguments is not checked. Use ONC validator for that.
29 CHROMEOS_EXPORT scoped_ptr<base::DictionaryValue>
30 MergeSettingsAndPoliciesToEffective(
31     const base::DictionaryValue* user_policy,
32     const base::DictionaryValue* device_policy,
33     const base::DictionaryValue* user_settings,
34     const base::DictionaryValue* shared_settings);
35 
36 // Like MergeSettingsWithPoliciesToEffective but creates one dictionary in place
37 // of each field that exists in any of the argument dictionaries. Each of these
38 // dictionaries contains the onc::kAugmentations* fields (see onc_constants.h)
39 // for which a value is available. The onc::kAugmentationEffectiveSetting field
40 // contains the field name of the field containing the effective field that
41 // overrides all other values. Credentials from policies are not written to the
42 // result.
43 CHROMEOS_EXPORT scoped_ptr<base::DictionaryValue>
44 MergeSettingsAndPoliciesToAugmented(
45     const OncValueSignature& signature,
46     const base::DictionaryValue* user_policy,
47     const base::DictionaryValue* device_policy,
48     const base::DictionaryValue* user_settings,
49     const base::DictionaryValue* shared_settings,
50     const base::DictionaryValue* active_settings);
51 
52 }  // namespace onc
53 }  // namespace chromeos
54 
55 #endif  // CHROMEOS_NETWORK_ONC_ONC_MERGER_H_
56