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

Side by Side Diff: chrome/installer/util/master_preferences.cc

Issue 1120006: detect preferences errors (Closed)
Patch Set: changes from review Created 10 years, 8 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/installer/util/master_preferences.h" 5 #include "chrome/installer/util/master_preferences.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "chrome/common/json_value_serializer.h" 10 #include "chrome/common/json_value_serializer.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 if (!file_util::PathExists(master_prefs_path)) { 162 if (!file_util::PathExists(master_prefs_path)) {
163 LOG(WARNING) << "Master preferences file not found: " 163 LOG(WARNING) << "Master preferences file not found: "
164 << master_prefs_path.value(); 164 << master_prefs_path.value();
165 return NULL; 165 return NULL;
166 } 166 }
167 std::string json_data; 167 std::string json_data;
168 if (!file_util::ReadFileToString(master_prefs_path, &json_data)) 168 if (!file_util::ReadFileToString(master_prefs_path, &json_data))
169 return NULL; 169 return NULL;
170 170
171 JSONStringValueSerializer json(json_data); 171 JSONStringValueSerializer json(json_data);
172 scoped_ptr<Value> root(json.Deserialize(NULL)); 172 scoped_ptr<Value> root(json.Deserialize(NULL, NULL));
173 173
174 if (!root.get()) 174 if (!root.get())
175 return NULL; 175 return NULL;
176 176
177 if (!root->IsType(Value::TYPE_DICTIONARY)) 177 if (!root->IsType(Value::TYPE_DICTIONARY))
178 return NULL; 178 return NULL;
179 179
180 return static_cast<DictionaryValue*>(root.release()); 180 return static_cast<DictionaryValue*>(root.release());
181 } 181 }
182 182
(...skipping 10 matching lines...) Expand all
193 return true; 193 return true;
194 } 194 }
195 195
196 bool HasExtensionsBlock(const DictionaryValue* prefs, 196 bool HasExtensionsBlock(const DictionaryValue* prefs,
197 DictionaryValue** extensions) { 197 DictionaryValue** extensions) {
198 return (prefs->GetDictionary(master_preferences::kExtensionsBlock, 198 return (prefs->GetDictionary(master_preferences::kExtensionsBlock,
199 extensions)); 199 extensions));
200 } 200 }
201 201
202 } // installer_util 202 } // installer_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698