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

Unified Diff: extensions/browser/extension_prefs.cc

Issue 2370633002: replace deprecated version of SetWithoutPathExpansion (Closed)
Patch Set: use MakeUnique Created 4 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/browser/event_router.cc ('k') | extensions/browser/value_store/leveldb_value_store.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/extension_prefs.cc
diff --git a/extensions/browser/extension_prefs.cc b/extensions/browser/extension_prefs.cc
index 56645a72564cfaf2ff64c922cec00eb1f5edd514..55083ee48e0a0d261d50af16223e46a99451968e 100644
--- a/extensions/browser/extension_prefs.cc
+++ b/extensions/browser/extension_prefs.cc
@@ -202,7 +202,7 @@ class ScopedExtensionPrefUpdate : public DictionaryPrefUpdate {
if (!dict->GetDictionary(extension_id_, &extension)) {
// Extension pref does not exist, create it.
extension = new base::DictionaryValue();
- dict->SetWithoutPathExpansion(extension_id_, extension);
+ dict->SetWithoutPathExpansion(extension_id_, base::WrapUnique(extension));
}
return extension;
}
@@ -298,16 +298,16 @@ T* ExtensionPrefs::ScopedUpdate<T, type_enum_value>::Get() {
template <typename T, base::Value::Type type_enum_value>
T* ExtensionPrefs::ScopedUpdate<T, type_enum_value>::Create() {
base::DictionaryValue* dict = update_.Get();
- base::DictionaryValue* extension = NULL;
- base::Value* key_value = NULL;
- T* value_as_t = NULL;
+ base::DictionaryValue* extension = nullptr;
+ base::Value* key_value = nullptr;
+ T* value_as_t = nullptr;
if (!dict->GetDictionary(extension_id_, &extension)) {
extension = new base::DictionaryValue;
- dict->SetWithoutPathExpansion(extension_id_, extension);
+ dict->SetWithoutPathExpansion(extension_id_, base::WrapUnique(extension));
}
if (!extension->Get(key_, &key_value)) {
value_as_t = new T;
- extension->SetWithoutPathExpansion(key_, value_as_t);
+ extension->SetWithoutPathExpansion(key_, base::WrapUnique(value_as_t));
} else {
// It would be nice to CHECK that this doesn't happen, but since prefs can
// get into a mangled state, we can't really do that. Instead, handle it
@@ -322,7 +322,7 @@ T* ExtensionPrefs::ScopedUpdate<T, type_enum_value>::Create() {
base::IntToString(static_cast<int>(key_value->GetType())));
base::debug::DumpWithoutCrashing();
value_as_t = new T();
- extension->SetWithoutPathExpansion(key_, value_as_t);
+ extension->SetWithoutPathExpansion(key_, base::WrapUnique(value_as_t));
} else {
value_as_t = static_cast<T*>(key_value);
}
« no previous file with comments | « extensions/browser/event_router.cc ('k') | extensions/browser/value_store/leveldb_value_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698