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

Side by Side Diff: chrome/browser/policy/config_dir_policy_loader.cc

Issue 21030009: Make element removal methods in DictionaryValue and ListValue take scoped_ptr's as outparams. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 7 years, 4 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/browser/policy/config_dir_policy_loader.h" 5 #include "chrome/browser/policy/config_dir_policy_loader.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 } 152 }
153 base::DictionaryValue* dictionary_value = NULL; 153 base::DictionaryValue* dictionary_value = NULL;
154 if (!value->GetAsDictionary(&dictionary_value)) { 154 if (!value->GetAsDictionary(&dictionary_value)) {
155 LOG(WARNING) << "Expected JSON dictionary in configuration file " 155 LOG(WARNING) << "Expected JSON dictionary in configuration file "
156 << config_file_iter->value(); 156 << config_file_iter->value();
157 status.Add(POLICY_LOAD_STATUS_PARSE_ERROR); 157 status.Add(POLICY_LOAD_STATUS_PARSE_ERROR);
158 continue; 158 continue;
159 } 159 }
160 160
161 // Detach the "3rdparty" node. 161 // Detach the "3rdparty" node.
162 base::Value* third_party = NULL; 162 scoped_ptr<base::Value> third_party;
163 if (dictionary_value->Remove("3rdparty", &third_party)) { 163 if (dictionary_value->Remove("3rdparty", &third_party))
164 Merge3rdPartyPolicy(third_party, level, bundle); 164 Merge3rdPartyPolicy(third_party.get(), level, bundle);
165 delete third_party;
166 }
167 165
168 // Add chrome policy. 166 // Add chrome policy.
169 PolicyMap policy_map; 167 PolicyMap policy_map;
170 policy_map.LoadFrom(dictionary_value, level, scope_); 168 policy_map.LoadFrom(dictionary_value, level, scope_);
171 bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) 169 bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()))
172 .MergeFrom(policy_map); 170 .MergeFrom(policy_map);
173 } 171 }
174 } 172 }
175 173
176 void ConfigDirPolicyLoader::Merge3rdPartyPolicy( 174 void ConfigDirPolicyLoader::Merge3rdPartyPolicy(
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 } 222 }
225 } 223 }
226 224
227 void ConfigDirPolicyLoader::OnFileUpdated(const base::FilePath& path, 225 void ConfigDirPolicyLoader::OnFileUpdated(const base::FilePath& path,
228 bool error) { 226 bool error) {
229 if (!error) 227 if (!error)
230 Reload(false); 228 Reload(false);
231 } 229 }
232 230
233 } // namespace policy 231 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/cloud/component_cloud_policy_store.cc ('k') | chrome/browser/ui/webui/about_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698