| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/json_schema/json_schema_validator.h" | 5 #include "components/json_schema/json_schema_validator.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cfloat> | 8 #include <cfloat> |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/json/json_reader.h" | 12 #include "base/json/json_reader.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
| 15 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
| 17 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
| 18 #include "base/values.h" | 18 #include "base/values.h" |
| 19 #include "components/json_schema/json_schema_constants.h" | 19 #include "components/json_schema/json_schema_constants.h" |
| 20 #include "third_party/re2/re2/re2.h" | 20 #include "third_party/re2/src/re2/re2.h" |
| 21 | 21 |
| 22 namespace schema = json_schema_constants; | 22 namespace schema = json_schema_constants; |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 double GetNumberValue(const base::Value* value) { | 26 double GetNumberValue(const base::Value* value) { |
| 27 double result = 0; | 27 double result = 0; |
| 28 CHECK(value->GetAsDouble(&result)) | 28 CHECK(value->GetAsDouble(&result)) |
| 29 << "Unexpected value type: " << value->GetType(); | 29 << "Unexpected value type: " << value->GetType(); |
| 30 return result; | 30 return result; |
| (...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 836 | 836 |
| 837 if (*additional_properties_schema) { | 837 if (*additional_properties_schema) { |
| 838 std::string additional_properties_type(schema::kAny); | 838 std::string additional_properties_type(schema::kAny); |
| 839 CHECK((*additional_properties_schema)->GetString( | 839 CHECK((*additional_properties_schema)->GetString( |
| 840 schema::kType, &additional_properties_type)); | 840 schema::kType, &additional_properties_type)); |
| 841 return additional_properties_type == schema::kAny; | 841 return additional_properties_type == schema::kAny; |
| 842 } else { | 842 } else { |
| 843 return default_allow_additional_properties_; | 843 return default_allow_additional_properties_; |
| 844 } | 844 } |
| 845 } | 845 } |
| OLD | NEW |