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 #include "chromeos/network/onc/onc_validator.h" | 5 #include "chromeos/network/onc/onc_validator.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 | 318 |
319 return !error_on_missing_field_ || all_required_exist; | 319 return !error_on_missing_field_ || all_required_exist; |
320 } | 320 } |
321 | 321 |
322 namespace { | 322 namespace { |
323 | 323 |
324 std::string JoinStringRange(const std::vector<const char*>& strings, | 324 std::string JoinStringRange(const std::vector<const char*>& strings, |
325 const std::string& separator) { | 325 const std::string& separator) { |
326 std::vector<std::string> string_vector; | 326 std::vector<std::string> string_vector; |
327 std::copy(strings.begin(), strings.end(), std::back_inserter(string_vector)); | 327 std::copy(strings.begin(), strings.end(), std::back_inserter(string_vector)); |
328 return JoinString(string_vector, separator); | 328 return base::JoinString(string_vector, separator); |
329 } | 329 } |
330 | 330 |
331 } // namespace | 331 } // namespace |
332 | 332 |
333 bool Validator::FieldExistsAndHasNoValidValue( | 333 bool Validator::FieldExistsAndHasNoValidValue( |
334 const base::DictionaryValue& object, | 334 const base::DictionaryValue& object, |
335 const std::string& field_name, | 335 const std::string& field_name, |
336 const std::vector<const char*>& valid_values) { | 336 const std::vector<const char*>& valid_values) { |
337 std::string actual_value; | 337 std::string actual_value; |
338 if (!object.GetStringWithoutPathExpansion(field_name, &actual_value)) | 338 if (!object.GetStringWithoutPathExpansion(field_name, &actual_value)) |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 if (type == kClient) | 945 if (type == kClient) |
946 all_required_exist &= RequireField(*result, kPKCS12); | 946 all_required_exist &= RequireField(*result, kPKCS12); |
947 else if (type == kServer || type == kAuthority) | 947 else if (type == kServer || type == kAuthority) |
948 all_required_exist &= RequireField(*result, kX509); | 948 all_required_exist &= RequireField(*result, kX509); |
949 } | 949 } |
950 | 950 |
951 return !error_on_missing_field_ || all_required_exist; | 951 return !error_on_missing_field_ || all_required_exist; |
952 } | 952 } |
953 | 953 |
954 std::string Validator::MessageHeader() { | 954 std::string Validator::MessageHeader() { |
955 std::string path = path_.empty() ? "toplevel" : JoinString(path_, "."); | 955 std::string path = path_.empty() ? "toplevel" : base::JoinString(path_, "."); |
956 std::string message = "At " + path + ": "; | 956 std::string message = "At " + path + ": "; |
957 return message; | 957 return message; |
958 } | 958 } |
959 | 959 |
960 } // namespace onc | 960 } // namespace onc |
961 } // namespace chromeos | 961 } // namespace chromeos |
OLD | NEW |