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

Side by Side Diff: chromeos/network/onc_mapper.h

Issue 11299236: This moves the ONC parsing code into chromeos/network/onc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | Annotate | Revision Log
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 CHROME_BROWSER_CHROMEOS_NETWORK_SETTINGS_ONC_MAPPER_H_ 5 #ifndef CHROMEOS_NETWORK_ONC_MAPPER_H_
6 #define CHROME_BROWSER_CHROMEOS_NETWORK_SETTINGS_ONC_MAPPER_H_ 6 #define CHROMEOS_NETWORK_ONC_MAPPER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "chromeos/chromeos_export.h"
11 12
12 namespace base { 13 namespace base {
13 class Value; 14 class Value;
14 class DictionaryValue; 15 class DictionaryValue;
15 class ListValue; 16 class ListValue;
16 } 17 }
17 18
18 namespace chromeos { 19 namespace chromeos {
19 namespace onc { 20 namespace onc {
20 21
21 struct OncValueSignature; 22 struct OncValueSignature;
22 23
23 // This class implements a DeepCopy of base::Values for ONC objects that 24 // This class implements a DeepCopy of base::Values for ONC objects that
24 // iterates over both the ONC signature and the object hierarchy. DCHECKs if a 25 // iterates over both the ONC signature and the object hierarchy. DCHECKs if a
25 // field signature without value signature or an array signature without entry 26 // field signature without value signature or an array signature without entry
26 // signature is reached. 27 // signature is reached.
27 // 28 //
28 // The general term "map" is used here, as this class is meant as base class and 29 // The general term "map" is used here, as this class is meant as base class and
29 // the copy behavior can be adapted by overriding the methods. By comparing the 30 // the copy behavior can be adapted by overriding the methods. By comparing the
30 // address of a signature object to the list of signatures in "onc_signature.h", 31 // address of a signature object to the list of signatures in "onc_signature.h",
31 // accurate signature-specific translations or validations can be applied in the 32 // accurate signature-specific translations or validations can be applied in the
32 // overriding methods. 33 // overriding methods.
33 // 34 //
34 // The ONC validator and normalizer derive from this class and adapt the default 35 // The ONC validator and normalizer derive from this class and adapt the default
35 // copy behavior. 36 // copy behavior.
36 class Mapper { 37 class CHROMEOS_EXPORT Mapper {
pneubeck (no reviews) 2012/11/28 22:20:41 do we have to export base classes? otherwise Mappe
Greg Spencer (Chromium) 2012/11/28 23:09:14 No, we don't. Done.
37 public: 38 public:
38 Mapper(); 39 Mapper();
39 virtual ~Mapper(); 40 virtual ~Mapper();
40 41
41 protected: 42 protected:
42 // Calls |MapObject|, |MapArray| and |MapPrimitive| according to |onc_value|'s 43 // Calls |MapObject|, |MapArray| and |MapPrimitive| according to |onc_value|'s
43 // type. By default aborts on nested errors in arrays. Result of the mapping 44 // type. By default aborts on nested errors in arrays. Result of the mapping
44 // is returned. On error returns NULL. 45 // is returned. On error returns NULL.
45 virtual scoped_ptr<base::Value> MapValue( 46 virtual scoped_ptr<base::Value> MapValue(
46 const OncValueSignature& signature, 47 const OncValueSignature& signature,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 const base::ListValue& onc_array, 94 const base::ListValue& onc_array,
94 bool* nested_error_occured); 95 bool* nested_error_occured);
95 96
96 private: 97 private:
97 DISALLOW_COPY_AND_ASSIGN(Mapper); 98 DISALLOW_COPY_AND_ASSIGN(Mapper);
98 }; 99 };
99 100
100 } // namespace onc 101 } // namespace onc
101 } // namespace chromeos 102 } // namespace chromeos
102 103
103 #endif // CHROME_BROWSER_CHROMEOS_NETWORK_SETTINGS_ONC_MAPPER_H_ 104 #endif // CHROMEOS_NETWORK_ONC_MAPPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698