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

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

Issue 5624002: Move more code from headers to implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 10 years 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "app/l10n_util.h" 10 #include "app/l10n_util.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 CHECK(types->GetDictionary(i, &type)); 152 CHECK(types->GetDictionary(i, &type));
153 153
154 std::string id; 154 std::string id;
155 CHECK(type->GetString("id", &id)); 155 CHECK(type->GetString("id", &id));
156 156
157 CHECK(types_.find(id) == types_.end()); 157 CHECK(types_.find(id) == types_.end());
158 types_[id] = type; 158 types_[id] = type;
159 } 159 }
160 } 160 }
161 161
162 JSONSchemaValidator::~JSONSchemaValidator() {}
162 163
163 bool JSONSchemaValidator::Validate(Value* instance) { 164 bool JSONSchemaValidator::Validate(Value* instance) {
164 errors_.clear(); 165 errors_.clear();
165 Validate(instance, schema_root_, ""); 166 Validate(instance, schema_root_, "");
166 return errors_.empty(); 167 return errors_.empty();
167 } 168 }
168 169
169 void JSONSchemaValidator::Validate(Value* instance, 170 void JSONSchemaValidator::Validate(Value* instance,
170 DictionaryValue* schema, 171 DictionaryValue* schema,
171 const std::string& path) { 172 const std::string& path) {
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 495
495 if (*additional_properties_schema) { 496 if (*additional_properties_schema) {
496 std::string additional_properties_type("any"); 497 std::string additional_properties_type("any");
497 CHECK((*additional_properties_schema)->GetString( 498 CHECK((*additional_properties_schema)->GetString(
498 "type", &additional_properties_type)); 499 "type", &additional_properties_type));
499 return additional_properties_type == "any"; 500 return additional_properties_type == "any";
500 } else { 501 } else {
501 return default_allow_additional_properties_; 502 return default_allow_additional_properties_;
502 } 503 }
503 } 504 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698