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

Side by Side Diff: components/policy/core/common/schema_map.cc

Issue 1940153002: Use std::unique_ptr to express ownership of base::Value in PolicyMap::Entry (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another-fix Created 4 years, 7 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
OLDNEW
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_map.h" 5 #include "components/policy/core/common/schema_map.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "components/policy/core/common/policy_bundle.h" 9 #include "components/policy/core/common/policy_bundle.h"
10 #include "components/policy/core/common/policy_map.h" 10 #include "components/policy/core/common/policy_map.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 if (!schema->valid()) { 64 if (!schema->valid()) {
65 // Don't serve unknown policies. 65 // Don't serve unknown policies.
66 it->second->Clear(); 66 it->second->Clear();
67 continue; 67 continue;
68 } 68 }
69 69
70 PolicyMap* map = it->second; 70 PolicyMap* map = it->second;
71 for (PolicyMap::const_iterator it_map = map->begin(); 71 for (PolicyMap::const_iterator it_map = map->begin();
72 it_map != map->end();) { 72 it_map != map->end();) {
73 const std::string& policy_name = it_map->first; 73 const std::string& policy_name = it_map->first;
74 const base::Value* policy_value = it_map->second.value; 74 const base::Value* policy_value = it_map->second.value.get();
75 Schema policy_schema = schema->GetProperty(policy_name); 75 Schema policy_schema = schema->GetProperty(policy_name);
76 ++it_map; 76 ++it_map;
77 std::string error_path; 77 std::string error_path;
78 std::string error; 78 std::string error;
79 if (!policy_value || 79 if (!policy_value ||
80 !policy_schema.Validate(*policy_value, 80 !policy_schema.Validate(*policy_value,
81 SCHEMA_STRICT, 81 SCHEMA_STRICT,
82 &error_path, 82 &error_path,
83 &error)) { 83 &error)) {
84 LOG(ERROR) << "Dropping policy " << policy_name << " for " 84 LOG(ERROR) << "Dropping policy " << policy_name << " for "
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 for (ComponentMap::const_iterator comp = components.begin(); 118 for (ComponentMap::const_iterator comp = components.begin();
119 comp != components.end(); ++comp) { 119 comp != components.end(); ++comp) {
120 PolicyNamespace ns(domain->first, comp->first); 120 PolicyNamespace ns(domain->first, comp->first);
121 if (!other->GetSchema(ns)) 121 if (!other->GetSchema(ns))
122 list->push_back(ns); 122 list->push_back(ns);
123 } 123 }
124 } 124 }
125 } 125 }
126 126
127 } // namespace policy 127 } // namespace policy
OLDNEW
« no previous file with comments | « components/policy/core/common/proxy_policy_provider_unittest.cc ('k') | components/policy/core/common/schema_map_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698