| 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/policy/core/common/schema.h" | 5 #include "components/policy/core/common/schema.h" |
| 6 | 6 |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 schema.HasKey(schema::kMaximum)) { | 481 schema.HasKey(schema::kMaximum)) { |
| 482 if (type != base::Value::TYPE_INTEGER) { | 482 if (type != base::Value::TYPE_INTEGER) { |
| 483 *error = "Only integers can have minimum and maximum"; | 483 *error = "Only integers can have minimum and maximum"; |
| 484 return false; | 484 return false; |
| 485 } | 485 } |
| 486 if (!ParseRangedInt(schema, schema_node, error)) | 486 if (!ParseRangedInt(schema, schema_node, error)) |
| 487 return false; | 487 return false; |
| 488 } | 488 } |
| 489 std::string id_string; | 489 std::string id_string; |
| 490 if (schema.GetString(schema::kId, &id_string)) { | 490 if (schema.GetString(schema::kId, &id_string)) { |
| 491 if (ContainsKey(*id_map, id_string)) { | 491 if (base::ContainsKey(*id_map, id_string)) { |
| 492 *error = "Duplicated id: " + id_string; | 492 *error = "Duplicated id: " + id_string; |
| 493 return false; | 493 return false; |
| 494 } | 494 } |
| 495 (*id_map)[id_string] = *index; | 495 (*id_map)[id_string] = *index; |
| 496 } | 496 } |
| 497 | 497 |
| 498 return true; | 498 return true; |
| 499 } | 499 } |
| 500 | 500 |
| 501 bool Schema::InternalStorage::ParseDictionary( | 501 bool Schema::InternalStorage::ParseDictionary( |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1105 return false; | 1105 return false; |
| 1106 } else { | 1106 } else { |
| 1107 int index = rnode->string_pattern_restriction.pattern_index; | 1107 int index = rnode->string_pattern_restriction.pattern_index; |
| 1108 DCHECK(index == rnode->string_pattern_restriction.pattern_index_backup); | 1108 DCHECK(index == rnode->string_pattern_restriction.pattern_index_backup); |
| 1109 re2::RE2* regex = storage_->CompileRegex(*storage_->string_enums(index)); | 1109 re2::RE2* regex = storage_->CompileRegex(*storage_->string_enums(index)); |
| 1110 return re2::RE2::PartialMatch(str, *regex); | 1110 return re2::RE2::PartialMatch(str, *regex); |
| 1111 } | 1111 } |
| 1112 } | 1112 } |
| 1113 | 1113 |
| 1114 } // namespace policy | 1114 } // namespace policy |
| OLD | NEW |