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

Side by Side Diff: chrome/common/json_schema/json_schema_validator.cc

Issue 12886024: Move JSON schema validator code into its own directory in chrome/common (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
OLDNEW
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/json_schema_validator.h"
6 6
7 #include <cfloat> 7 #include <cfloat>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/common/json_schema_constants.h" 13 #include "chrome/common/json_schema/json_schema_constants.h"
14 #include "ui/base/l10n/l10n_util.h" 14 #include "ui/base/l10n/l10n_util.h"
15 15
16 namespace schema = json_schema_constants; 16 namespace schema = json_schema_constants;
17 17
18 namespace { 18 namespace {
19 19
20 double GetNumberValue(const Value* value) { 20 double GetNumberValue(const Value* value) {
21 double result = 0; 21 double result = 0;
22 CHECK(value->GetAsDouble(&result)) 22 CHECK(value->GetAsDouble(&result))
23 << "Unexpected value type: " << value->GetType(); 23 << "Unexpected value type: " << value->GetType();
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 487
488 if (*additional_properties_schema) { 488 if (*additional_properties_schema) {
489 std::string additional_properties_type(schema::kAny); 489 std::string additional_properties_type(schema::kAny);
490 CHECK((*additional_properties_schema)->GetString( 490 CHECK((*additional_properties_schema)->GetString(
491 schema::kType, &additional_properties_type)); 491 schema::kType, &additional_properties_type));
492 return additional_properties_type == schema::kAny; 492 return additional_properties_type == schema::kAny;
493 } else { 493 } else {
494 return default_allow_additional_properties_; 494 return default_allow_additional_properties_;
495 } 495 }
496 } 496 }
OLDNEW
« no previous file with comments | « chrome/common/json_schema/json_schema_validator.h ('k') | chrome/common/json_schema/json_schema_validator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698