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

Unified Diff: chrome/browser/extensions/external_pref_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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/external_pref_loader.cc
diff --git a/chrome/browser/extensions/external_pref_loader.cc b/chrome/browser/extensions/external_pref_loader.cc
index c0775d2de2c070883bf455ea2cf1fdded82d4279..0e71a49d8807c1774b6be266d97e744f38fac6d2 100644
--- a/chrome/browser/extensions/external_pref_loader.cc
+++ b/chrome/browser/extensions/external_pref_loader.cc
@@ -72,20 +72,24 @@ std::set<base::FilePath> GetPrefsCandidateFilesFromFolder(
// occurs). An empty dictionary is returned in case of failure (e.g. invalid
// path or json content).
// Caller takes ownership of the returned dictionary.
+// TODO(Olli Raula) Make return scoped_ptr
base::DictionaryValue* ExtractExtensionPrefs(
base::ValueDeserializer* deserializer,
const base::FilePath& path) {
std::string error_msg;
- base::Value* extensions = deserializer->Deserialize(NULL, &error_msg);
+ scoped_ptr<base::Value> extensions =
+ deserializer->Deserialize(NULL, &error_msg);
if (!extensions) {
LOG(WARNING) << "Unable to deserialize json data: " << error_msg
<< " in file " << path.value() << ".";
return new base::DictionaryValue;
}
- base::DictionaryValue* ext_dictionary = NULL;
- if (extensions->GetAsDictionary(&ext_dictionary))
- return ext_dictionary;
+ scoped_ptr<base::DictionaryValue> ext_dictionary =
+ base::DictionaryValue::From(extensions.Pass());
+ if (ext_dictionary) {
+ return ext_dictionary.release();
+ }
LOG(WARNING) << "Expected a JSON dictionary in file "
<< path.value() << ".";
« no previous file with comments | « chrome/browser/extensions/extension_service_unittest.cc ('k') | chrome/browser/extensions/user_script_listener_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698