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

Unified Diff: extensions/utility/unpacker.cc

Issue 1308013005: Add scoped_ptr-safe base::Value to Dictionary/List conversion functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Made conversions static members. Created 5 years, 3 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
« no previous file with comments | « extensions/utility/unpacker.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/utility/unpacker.cc
diff --git a/extensions/utility/unpacker.cc b/extensions/utility/unpacker.cc
index 2cd8f0150e727139411181ab010b174a9e2de160..6e28a49b31a2c301a3f1dfe256a9d93cb4aed19d 100644
--- a/extensions/utility/unpacker.cc
+++ b/extensions/utility/unpacker.cc
@@ -112,7 +112,7 @@ Unpacker::Unpacker(const base::FilePath& working_dir,
Unpacker::~Unpacker() {
}
-base::DictionaryValue* Unpacker::ReadManifest() {
+scoped_ptr<base::DictionaryValue> Unpacker::ReadManifest() {
base::FilePath manifest_path = extension_dir_.Append(kManifestFilename);
if (!base::PathExists(manifest_path)) {
SetError(errors::kInvalidManifest);
@@ -132,7 +132,7 @@ base::DictionaryValue* Unpacker::ReadManifest() {
return NULL;
}
- return static_cast<base::DictionaryValue*>(root.release());
+ return base::DictionaryValue::From(root.Pass());
}
bool Unpacker::ReadAllMessageCatalogs(const std::string& default_locale) {
@@ -161,7 +161,7 @@ bool Unpacker::ReadAllMessageCatalogs(const std::string& default_locale) {
bool Unpacker::Run() {
// Parse the manifest.
- parsed_manifest_.reset(ReadManifest());
+ parsed_manifest_ = ReadManifest();
if (!parsed_manifest_.get())
return false; // Error was already reported.
@@ -253,8 +253,8 @@ bool Unpacker::AddDecodedImage(const base::FilePath& path) {
bool Unpacker::ReadMessageCatalog(const base::FilePath& message_path) {
std::string error;
JSONFileValueDeserializer deserializer(message_path);
- scoped_ptr<base::DictionaryValue> root(static_cast<base::DictionaryValue*>(
- deserializer.Deserialize(NULL, &error)));
+ scoped_ptr<base::DictionaryValue> root = base::DictionaryValue::From(
+ make_scoped_ptr(deserializer.Deserialize(NULL, &error)));
if (!root.get()) {
base::string16 messages_file = message_path.LossyDisplayName();
if (error.empty()) {
« no previous file with comments | « extensions/utility/unpacker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698