| 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 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chromeos/network/onc/onc_signature.h" | 15 #include "chromeos/network/onc/onc_signature.h" |
| 16 #include "components/onc/onc_constants.h" | 16 #include "components/onc/onc_constants.h" |
| 17 | 17 |
| 18 namespace chromeos { | 18 namespace chromeos { |
| 19 namespace onc { | 19 namespace onc { |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 std::string ValueToString(const base::Value& value) { | |
| 24 std::string json; | |
| 25 base::JSONWriter::Write(&value, &json); | |
| 26 return json; | |
| 27 } | |
| 28 | |
| 29 // Copied from policy/configuration_policy_handler.cc. | 23 // Copied from policy/configuration_policy_handler.cc. |
| 30 // TODO(pneubeck): move to a common place like base/. | 24 // TODO(pneubeck): move to a common place like base/. |
| 31 std::string ValueTypeToString(base::Value::Type type) { | 25 std::string ValueTypeToString(base::Value::Type type) { |
| 32 static const char* strings[] = { | 26 static const char* strings[] = { |
| 33 "null", | 27 "null", |
| 34 "boolean", | 28 "boolean", |
| 35 "integer", | 29 "integer", |
| 36 "double", | 30 "double", |
| 37 "string", | 31 "string", |
| 38 "binary", | 32 "binary", |
| (...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 } | 790 } |
| 797 | 791 |
| 798 std::string Validator::MessageHeader() { | 792 std::string Validator::MessageHeader() { |
| 799 std::string path = path_.empty() ? "toplevel" : JoinString(path_, "."); | 793 std::string path = path_.empty() ? "toplevel" : JoinString(path_, "."); |
| 800 std::string message = "At " + path + ": "; | 794 std::string message = "At " + path + ": "; |
| 801 return message; | 795 return message; |
| 802 } | 796 } |
| 803 | 797 |
| 804 } // namespace onc | 798 } // namespace onc |
| 805 } // namespace chromeos | 799 } // namespace chromeos |
| OLD | NEW |