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

Unified Diff: chrome/browser/extensions/convert_user_script.cc

Issue 2806283002: Revert of Stop passing raw pointers to base::Value API in c/b/chromeos and c/b/extensions (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/convert_user_script.cc
diff --git a/chrome/browser/extensions/convert_user_script.cc b/chrome/browser/extensions/convert_user_script.cc
index 4ecbe013e659ddff7e0b5f93a5e9cbf8011774b6..bc0362807d7166502b8be90d7ae8d5c6cac236b1 100644
--- a/chrome/browser/extensions/convert_user_script.cc
+++ b/chrome/browser/extensions/convert_user_script.cc
@@ -16,10 +16,8 @@
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/json/json_file_value_serializer.h"
-#include "base/memory/ptr_util.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
-#include "base/values.h"
#include "chrome/common/chrome_paths.h"
#include "crypto/sha2.h"
#include "extensions/browser/extension_user_script_loader.h"
@@ -106,12 +104,12 @@
root->SetString(keys::kPublicKey, key);
root->SetBoolean(keys::kConvertedFromUserScript, true);
- auto js_files = base::MakeUnique<base::ListValue>();
+ base::ListValue* js_files = new base::ListValue();
js_files->AppendString("script.js");
// If the script provides its own match patterns, we use those. Otherwise, we
// generate some using the include globs.
- auto matches = base::MakeUnique<base::ListValue>();
+ base::ListValue* matches = new base::ListValue();
if (!script.url_patterns().is_empty()) {
for (URLPatternSet::const_iterator i = script.url_patterns().begin();
i != script.url_patterns().end(); ++i) {
@@ -124,7 +122,7 @@
}
// Read the exclude matches, if any are present.
- auto exclude_matches = base::MakeUnique<base::ListValue>();
+ base::ListValue* exclude_matches = new base::ListValue();
if (!script.exclude_url_patterns().is_empty()) {
for (URLPatternSet::const_iterator i =
script.exclude_url_patterns().begin();
@@ -133,20 +131,21 @@
}
}
- auto includes = base::MakeUnique<base::ListValue>();
+ base::ListValue* includes = new base::ListValue();
for (size_t i = 0; i < script.globs().size(); ++i)
includes->AppendString(script.globs().at(i));
- auto excludes = base::MakeUnique<base::ListValue>();
+ base::ListValue* excludes = new base::ListValue();
for (size_t i = 0; i < script.exclude_globs().size(); ++i)
excludes->AppendString(script.exclude_globs().at(i));
- auto content_script = base::MakeUnique<base::DictionaryValue>();
- content_script->Set(keys::kMatches, std::move(matches));
- content_script->Set(keys::kExcludeMatches, std::move(exclude_matches));
- content_script->Set(keys::kIncludeGlobs, std::move(includes));
- content_script->Set(keys::kExcludeGlobs, std::move(excludes));
- content_script->Set(keys::kJs, std::move(js_files));
+ std::unique_ptr<base::DictionaryValue> content_script(
+ new base::DictionaryValue());
+ content_script->Set(keys::kMatches, matches);
+ content_script->Set(keys::kExcludeMatches, exclude_matches);
+ content_script->Set(keys::kIncludeGlobs, includes);
+ content_script->Set(keys::kExcludeGlobs, excludes);
+ content_script->Set(keys::kJs, js_files);
if (script.run_location() == UserScript::DOCUMENT_START)
content_script->SetString(keys::kRunAt, values::kRunAtDocumentStart);
@@ -156,10 +155,10 @@
// This is the default, but store it just in case we change that.
content_script->SetString(keys::kRunAt, values::kRunAtDocumentIdle);
- auto content_scripts = base::MakeUnique<base::ListValue>();
+ base::ListValue* content_scripts = new base::ListValue();
content_scripts->Append(std::move(content_script));
- root->Set(keys::kContentScripts, std::move(content_scripts));
+ root->Set(keys::kContentScripts, content_scripts);
base::FilePath manifest_path = temp_dir.GetPath().Append(kManifestFilename);
JSONFileValueSerializer serializer(manifest_path);

Powered by Google App Engine
This is Rietveld 408576698