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

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

Issue 1394993004: Make ValueDeserializer::Deserialize return scoped_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix and add todo about not failed trybot Created 5 years, 2 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 (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 "components/policy/core/common/config_dir_policy_loader.h" 5 #include "components/policy/core/common/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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 // The files are processed in reverse order because |MergeFrom| gives priority 136 // The files are processed in reverse order because |MergeFrom| gives priority
137 // to existing keys, but the ConfigDirPolicyProvider gives priority to the 137 // to existing keys, but the ConfigDirPolicyProvider gives priority to the
138 // last file in lexicographic order. 138 // last file in lexicographic order.
139 for (std::set<base::FilePath>::reverse_iterator config_file_iter = 139 for (std::set<base::FilePath>::reverse_iterator config_file_iter =
140 files.rbegin(); config_file_iter != files.rend(); 140 files.rbegin(); config_file_iter != files.rend();
141 ++config_file_iter) { 141 ++config_file_iter) {
142 JSONFileValueDeserializer deserializer(*config_file_iter); 142 JSONFileValueDeserializer deserializer(*config_file_iter);
143 deserializer.set_allow_trailing_comma(true); 143 deserializer.set_allow_trailing_comma(true);
144 int error_code = 0; 144 int error_code = 0;
145 std::string error_msg; 145 std::string error_msg;
146 scoped_ptr<base::Value> value( 146 scoped_ptr<base::Value> value =
147 deserializer.Deserialize(&error_code, &error_msg)); 147 deserializer.Deserialize(&error_code, &error_msg);
148 if (!value.get()) { 148 if (!value.get()) {
149 LOG(WARNING) << "Failed to read configuration file " 149 LOG(WARNING) << "Failed to read configuration file "
150 << config_file_iter->value() << ": " << error_msg; 150 << config_file_iter->value() << ": " << error_msg;
151 status.Add(JsonErrorToPolicyLoadStatus(error_code)); 151 status.Add(JsonErrorToPolicyLoadStatus(error_code));
152 continue; 152 continue;
153 } 153 }
154 base::DictionaryValue* dictionary_value = NULL; 154 base::DictionaryValue* dictionary_value = NULL;
155 if (!value->GetAsDictionary(&dictionary_value)) { 155 if (!value->GetAsDictionary(&dictionary_value)) {
156 LOG(WARNING) << "Expected JSON dictionary in configuration file " 156 LOG(WARNING) << "Expected JSON dictionary in configuration file "
157 << config_file_iter->value(); 157 << config_file_iter->value();
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 } 224 }
225 } 225 }
226 226
227 void ConfigDirPolicyLoader::OnFileUpdated(const base::FilePath& path, 227 void ConfigDirPolicyLoader::OnFileUpdated(const base::FilePath& path,
228 bool error) { 228 bool error) {
229 if (!error) 229 if (!error)
230 Reload(false); 230 Reload(false);
231 } 231 }
232 232
233 } // namespace policy 233 } // namespace policy
OLDNEW
« no previous file with comments | « components/omnibox/browser/search_suggestion_parser.cc ('k') | components/update_client/component_patcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698