| OLD | NEW |
| 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_NORMALIZER_H_ | 5 #ifndef CHROMEOS_NETWORK_ONC_ONC_NORMALIZER_H_ |
| 6 #define CHROMEOS_NETWORK_ONC_ONC_NORMALIZER_H_ | 6 #define CHROMEOS_NETWORK_ONC_ONC_NORMALIZER_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "chromeos/chromeos_export.h" | 9 #include "chromeos/chromeos_export.h" |
| 10 #include "chromeos/network/onc/onc_mapper.h" | 10 #include "chromeos/network/onc/onc_mapper.h" |
| 11 | 11 |
| 12 namespace chromeos { | 12 namespace chromeos { |
| 13 namespace onc { | 13 namespace onc { |
| 14 | 14 |
| 15 struct OncValueSignature; | 15 struct OncValueSignature; |
| 16 | 16 |
| 17 class CHROMEOS_EXPORT Normalizer : public Mapper { | 17 class CHROMEOS_EXPORT Normalizer : public Mapper { |
| 18 public: | 18 public: |
| 19 explicit Normalizer(bool remove_recommended_fields); | 19 explicit Normalizer(bool remove_recommended_fields); |
| 20 virtual ~Normalizer(); | 20 virtual ~Normalizer(); |
| 21 | 21 |
| 22 // Removes all fields that are ignored/irrelevant because of the value of | 22 // Removes all fields that are ignored/irrelevant because of the value of |
| 23 // other fields. E.g. the "WiFi" field is irrelevant if the configurations | 23 // other fields. E.g. the "WiFi" field is irrelevant if the configurations |
| 24 // type is "Ethernet". If |remove_recommended_fields| is true, kRecommended | 24 // type is "Ethernet". If |remove_recommended_fields| is true, kRecommended |
| 25 // arrays are removed (the array itself and not the field names listed | 25 // arrays are removed (the array itself and not the field names listed |
| 26 // there). |object_signature| must point to one of the signatures in | 26 // there). |object_signature| must point to one of the signatures in |
| 27 // |onc_signature.h|. | 27 // |onc_signature.h|. For configurations of type "WiFi", if the "SSID" field |
| 28 // is set, but the field "HexSSID" is not, the contents of the "SSID" field is |
| 29 // converted to UTF-8 encoding, a hex representation of the byte sequence is |
| 30 // created and stored in the field "HexSSID". |
| 28 scoped_ptr<base::DictionaryValue> NormalizeObject( | 31 scoped_ptr<base::DictionaryValue> NormalizeObject( |
| 29 const OncValueSignature* object_signature, | 32 const OncValueSignature* object_signature, |
| 30 const base::DictionaryValue& onc_object); | 33 const base::DictionaryValue& onc_object); |
| 31 | 34 |
| 32 private: | 35 private: |
| 33 // Dispatch to the right normalization function according to |signature|. | 36 // Dispatch to the right normalization function according to |signature|. |
| 34 virtual scoped_ptr<base::DictionaryValue> MapObject( | 37 virtual scoped_ptr<base::DictionaryValue> MapObject( |
| 35 const OncValueSignature& signature, | 38 const OncValueSignature& signature, |
| 36 const base::DictionaryValue& onc_object, | 39 const base::DictionaryValue& onc_object, |
| 37 bool* error) override; | 40 bool* error) override; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 48 | 51 |
| 49 const bool remove_recommended_fields_; | 52 const bool remove_recommended_fields_; |
| 50 | 53 |
| 51 DISALLOW_COPY_AND_ASSIGN(Normalizer); | 54 DISALLOW_COPY_AND_ASSIGN(Normalizer); |
| 52 }; | 55 }; |
| 53 | 56 |
| 54 } // namespace onc | 57 } // namespace onc |
| 55 } // namespace chromeos | 58 } // namespace chromeos |
| 56 | 59 |
| 57 #endif // CHROMEOS_NETWORK_ONC_ONC_NORMALIZER_H_ | 60 #endif // CHROMEOS_NETWORK_ONC_ONC_NORMALIZER_H_ |
| OLD | NEW |