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

Side by Side Diff: chromeos/network/onc/onc_validator.h

Issue 166903002: Identify and repair ONC files with duplicate GUIDs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Issue_23567011
Patch Set: Created 6 years, 10 months 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
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 CHROMEOS_NETWORK_ONC_ONC_VALIDATOR_H_ 5 #ifndef CHROMEOS_NETWORK_ONC_ONC_VALIDATOR_H_
6 #define CHROMEOS_NETWORK_ONC_ONC_VALIDATOR_H_ 6 #define CHROMEOS_NETWORK_ONC_ONC_VALIDATOR_H_
7 7
8 #include <set>
8 #include <string> 9 #include <string>
9 #include <vector> 10 #include <vector>
10 11
11 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
12 #include "chromeos/chromeos_export.h" 13 #include "chromeos/chromeos_export.h"
13 #include "chromeos/network/onc/onc_mapper.h" 14 #include "chromeos/network/onc/onc_mapper.h"
14 #include "components/onc/onc_constants.h" 15 #include "components/onc/onc_constants.h"
15 16
16 namespace base { 17 namespace base {
17 class DictionaryValue; 18 class DictionaryValue;
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 bool FieldExistsAndIsNotInRange(const base::DictionaryValue& object, 168 bool FieldExistsAndIsNotInRange(const base::DictionaryValue& object,
168 const std::string &field_name, 169 const std::string &field_name,
169 int lower_bound, 170 int lower_bound,
170 int upper_bound); 171 int upper_bound);
171 172
172 bool FieldExistsAndIsEmpty(const base::DictionaryValue& object, 173 bool FieldExistsAndIsEmpty(const base::DictionaryValue& object,
173 const std::string& field_name); 174 const std::string& field_name);
174 175
175 bool RequireField(const base::DictionaryValue& dict, const std::string& key); 176 bool RequireField(const base::DictionaryValue& dict, const std::string& key);
176 177
178 bool VerifyGuidUniqueAndAddToHash(const base::DictionaryValue& dict,
pneubeck (no reviews) 2014/02/17 10:11:36 Hash -> Set ? Add a comment that explains when it
kaliamoorthi 2014/02/17 15:06:49 Done.
179 const std::string& kGUID,
180 std::set<std::string> *guids);
181
177 // Prohibit certificate patterns for device policy ONC so that an unmanaged 182 // Prohibit certificate patterns for device policy ONC so that an unmanaged
178 // user won't have a certificate presented for them involuntarily. 183 // user won't have a certificate presented for them involuntarily.
179 bool IsCertPatternInDevicePolicy(const std::string& cert_type); 184 bool IsCertPatternInDevicePolicy(const std::string& cert_type);
180 185
181 // Prohibit global network configuration in user ONC imports. 186 // Prohibit global network configuration in user ONC imports.
182 bool IsGlobalNetworkConfigInUserImport( 187 bool IsGlobalNetworkConfigInUserImport(
183 const base::DictionaryValue& onc_object); 188 const base::DictionaryValue& onc_object);
184 189
185 std::string MessageHeader(); 190 std::string MessageHeader();
186 191
187 const bool error_on_unknown_field_; 192 const bool error_on_unknown_field_;
188 const bool error_on_wrong_recommended_; 193 const bool error_on_wrong_recommended_;
189 const bool error_on_missing_field_; 194 const bool error_on_missing_field_;
190 const bool managed_onc_; 195 const bool managed_onc_;
191 196
192 ::onc::ONCSource onc_source_; 197 ::onc::ONCSource onc_source_;
193 198
194 // The path of field names and indices to the current value. Indices 199 // The path of field names and indices to the current value. Indices
195 // are stored as strings in decimal notation. 200 // are stored as strings in decimal notation.
196 std::vector<std::string> path_; 201 std::vector<std::string> path_;
197 202
203 std::set<std::string> network_guids_;
pneubeck (no reviews) 2014/02/17 10:11:36 add comments like: Accumulates all network GUIDs
kaliamoorthi 2014/02/17 15:06:49 Done.
204 std::set<std::string> certificate_guids_;
205
198 // Tracks if an error or warning occurred within validation initiated by 206 // Tracks if an error or warning occurred within validation initiated by
199 // function ValidateAndRepairObject. 207 // function ValidateAndRepairObject.
200 bool error_or_warning_found_; 208 bool error_or_warning_found_;
201 209
202 DISALLOW_COPY_AND_ASSIGN(Validator); 210 DISALLOW_COPY_AND_ASSIGN(Validator);
203 }; 211 };
204 212
205 } // namespace onc 213 } // namespace onc
206 } // namespace chromeos 214 } // namespace chromeos
207 215
208 #endif // CHROMEOS_NETWORK_ONC_ONC_VALIDATOR_H_ 216 #endif // CHROMEOS_NETWORK_ONC_ONC_VALIDATOR_H_
OLDNEW
« no previous file with comments | « no previous file | chromeos/network/onc/onc_validator.cc » ('j') | chromeos/network/onc/onc_validator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698