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

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

Issue 2030013003: Remove ListValue::Append(new {Fundamental,String}Value(...)) pattern in //chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 fdd2b9a2ecddae6d9bca3c422783e691f53b205b..316b6e56defe97e9c1175236d0f262aa5312f32f 100644
--- a/chrome/browser/extensions/convert_user_script.cc
+++ b/chrome/browser/extensions/convert_user_script.cc
@@ -103,7 +103,7 @@ scoped_refptr<Extension> ConvertUserScriptToExtension(
root->SetBoolean(keys::kConvertedFromUserScript, true);
base::ListValue* js_files = new base::ListValue();
- js_files->Append(new base::StringValue("script.js"));
+ js_files->AppendString("script.js");
// If the script provides its own match patterns, we use those. Otherwise, we
// generate some using the include globs.
@@ -111,12 +111,12 @@ scoped_refptr<Extension> ConvertUserScriptToExtension(
if (!script.url_patterns().is_empty()) {
for (URLPatternSet::const_iterator i = script.url_patterns().begin();
i != script.url_patterns().end(); ++i) {
- matches->Append(new base::StringValue(i->GetAsString()));
+ matches->AppendString(i->GetAsString());
}
} else {
// TODO(aa): Derive tighter matches where possible.
- matches->Append(new base::StringValue("http://*/*"));
- matches->Append(new base::StringValue("https://*/*"));
+ matches->AppendString("http://*/*");
+ matches->AppendString("https://*/*");
}
// Read the exclude matches, if any are present.
@@ -125,17 +125,17 @@ scoped_refptr<Extension> ConvertUserScriptToExtension(
for (URLPatternSet::const_iterator i =
script.exclude_url_patterns().begin();
i != script.exclude_url_patterns().end(); ++i) {
- exclude_matches->Append(new base::StringValue(i->GetAsString()));
+ exclude_matches->AppendString(i->GetAsString());
}
}
base::ListValue* includes = new base::ListValue();
for (size_t i = 0; i < script.globs().size(); ++i)
- includes->Append(new base::StringValue(script.globs().at(i)));
+ includes->AppendString(script.globs().at(i));
base::ListValue* excludes = new base::ListValue();
for (size_t i = 0; i < script.exclude_globs().size(); ++i)
- excludes->Append(new base::StringValue(script.exclude_globs().at(i)));
+ excludes->AppendString(script.exclude_globs().at(i));
base::DictionaryValue* content_script = new base::DictionaryValue();
content_script->Set(keys::kMatches, matches);

Powered by Google App Engine
This is Rietveld 408576698