| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/common/json_schema_validator.h" | 5 #include "chrome/common/json_schema_validator.h" |
| 6 | 6 |
| 7 #include <cfloat> | 7 #include <cfloat> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 switch (choice->GetType()) { | 242 switch (choice->GetType()) { |
| 243 case Value::TYPE_NULL: | 243 case Value::TYPE_NULL: |
| 244 case Value::TYPE_BOOLEAN: | 244 case Value::TYPE_BOOLEAN: |
| 245 case Value::TYPE_STRING: | 245 case Value::TYPE_STRING: |
| 246 if (instance->Equals(choice)) | 246 if (instance->Equals(choice)) |
| 247 return; | 247 return; |
| 248 break; | 248 break; |
| 249 | 249 |
| 250 case Value::TYPE_INTEGER: | 250 case Value::TYPE_INTEGER: |
| 251 case Value::TYPE_DOUBLE: | 251 case Value::TYPE_DOUBLE: |
| 252 if (instance->IsType(Value::TYPE_INTEGER) || | 252 if (instance->IsInteger() || instance->IsDouble()) { |
| 253 instance->IsType(Value::TYPE_DOUBLE)) { | |
| 254 if (GetNumberValue(choice) == GetNumberValue(instance)) | 253 if (GetNumberValue(choice) == GetNumberValue(instance)) |
| 255 return; | 254 return; |
| 256 } | 255 } |
| 257 break; | 256 break; |
| 258 | 257 |
| 259 default: | 258 default: |
| 260 CHECK(false) << "Unexpected type in enum: " << choice->GetType(); | 259 CHECK(false) << "Unexpected type in enum: " << choice->GetType(); |
| 261 } | 260 } |
| 262 } | 261 } |
| 263 | 262 |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 | 473 |
| 475 if (*additional_properties_schema) { | 474 if (*additional_properties_schema) { |
| 476 std::string additional_properties_type("any"); | 475 std::string additional_properties_type("any"); |
| 477 CHECK((*additional_properties_schema)->GetString( | 476 CHECK((*additional_properties_schema)->GetString( |
| 478 "type", &additional_properties_type)); | 477 "type", &additional_properties_type)); |
| 479 return additional_properties_type == "any"; | 478 return additional_properties_type == "any"; |
| 480 } else { | 479 } else { |
| 481 return default_allow_additional_properties_; | 480 return default_allow_additional_properties_; |
| 482 } | 481 } |
| 483 } | 482 } |
| OLD | NEW |