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

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

Issue 2777063003: Stop passing raw pointers to base::Value API in c/b/chromeos and c/b/extensions (Closed)
Patch Set: Just rebased 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/extension_management_test_util.cc
diff --git a/chrome/browser/extensions/extension_management_test_util.cc b/chrome/browser/extensions/extension_management_test_util.cc
index ec6313ca916d14c57f6661b86e9a15b1e3e3c9fc..7733efe66cbd162a0b2c8823ca5f232bb38ab5bc 100644
--- a/chrome/browser/extensions/extension_management_test_util.cc
+++ b/chrome/browser/extensions/extension_management_test_util.cc
@@ -49,7 +49,7 @@ void ExtensionManagementPrefUpdaterBase::UnsetPerExtensionSettings(
void ExtensionManagementPrefUpdaterBase::ClearPerExtensionSettings(
const ExtensionId& id) {
DCHECK(crx_file::id_util::IdIsValid(id));
- pref_->SetWithoutPathExpansion(id, new base::DictionaryValue());
+ pref_->SetWithoutPathExpansion(id, base::MakeUnique<base::DictionaryValue>());
}
// Helper functions for 'installation_mode' manipulation -----------------------
@@ -222,18 +222,20 @@ ExtensionManagementPrefUpdaterBase::TakePref() {
}
void ExtensionManagementPrefUpdaterBase::ClearList(const std::string& path) {
- pref_->Set(path, new base::ListValue());
+ pref_->Set(path, base::MakeUnique<base::ListValue>());
}
void ExtensionManagementPrefUpdaterBase::AddStringToList(
const std::string& path,
const std::string& str) {
- base::ListValue* list_value = nullptr;
- if (!pref_->GetList(path, &list_value)) {
- list_value = new base::ListValue();
- pref_->Set(path, list_value);
+ base::ListValue* list_value_weak = nullptr;
+ if (!pref_->GetList(path, &list_value_weak)) {
+ auto list_value = base::MakeUnique<base::ListValue>();
+ list_value_weak = list_value.get();
+ pref_->Set(path, std::move(list_value));
}
- CHECK(list_value->AppendIfNotPresent(base::MakeUnique<base::Value>(str)));
+ CHECK(
+ list_value_weak->AppendIfNotPresent(base::MakeUnique<base::Value>(str)));
}
void ExtensionManagementPrefUpdaterBase::RemoveStringFromList(

Powered by Google App Engine
This is Rietveld 408576698