OLD | NEW |
| (Empty) |
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 CHROME_BROWSER_CHROMEOS_NETWORK_SETTINGS_ONC_NORMALIZER_H_ | |
6 #define CHROME_BROWSER_CHROMEOS_NETWORK_SETTINGS_ONC_NORMALIZER_H_ | |
7 | |
8 #include "base/memory/scoped_ptr.h" | |
9 #include "chrome/browser/chromeos/network_settings/onc_mapper.h" | |
10 | |
11 namespace chromeos { | |
12 namespace onc { | |
13 | |
14 struct OncValueSignature; | |
15 | |
16 class Normalizer : public Mapper { | |
17 public: | |
18 explicit Normalizer(bool remove_recommended_fields); | |
19 virtual ~Normalizer(); | |
20 | |
21 // Removes all fields that are ignored/irrelevant because of the value of | |
22 // other fields. E.g. the "WiFi" field is irrelevant if the configurations | |
23 // type is "Ethernet". If |remove_recommended_fields| is true, kRecommended | |
24 // arrays are removed (the array itself and not the field names listed | |
25 // there). |object_signature| must point to one of the signatures in | |
26 // |onc_signature.h|. | |
27 scoped_ptr<base::DictionaryValue> NormalizeObject( | |
28 const OncValueSignature* object_signature, | |
29 const base::DictionaryValue& onc_object); | |
30 | |
31 private: | |
32 // Dispatch to the right normalization function according to |signature|. | |
33 virtual scoped_ptr<base::DictionaryValue> MapObject( | |
34 const OncValueSignature& signature, | |
35 const base::DictionaryValue& onc_object) OVERRIDE; | |
36 | |
37 void NormalizeIPsec(base::DictionaryValue* ipsec); | |
38 void NormalizeVPN(base::DictionaryValue* vpn); | |
39 void NormalizeNetworkConfiguration(base::DictionaryValue* network); | |
40 | |
41 const bool remove_recommended_fields_; | |
42 | |
43 DISALLOW_COPY_AND_ASSIGN(Normalizer); | |
44 }; | |
45 | |
46 } // namespace onc | |
47 } // namespace chromeos | |
48 | |
49 #endif // CHROME_BROWSER_CHROMEOS_NETWORK_SETTINGS_ONC_NORMALIZER_H_ | |
OLD | NEW |