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

Unified Diff: chrome/browser/extensions/api/preference/preference_api.cc

Issue 2323993004: Remove use of deprecated base::ListValue::Append(Value*) overload in extensions. (Closed)
Patch Set: ... I hate C++ 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
Index: chrome/browser/extensions/api/preference/preference_api.cc
diff --git a/chrome/browser/extensions/api/preference/preference_api.cc b/chrome/browser/extensions/api/preference/preference_api.cc
index bbe63955fc4eb6eb0644c82383b8f24d627d2d57..16cf1064189130140838081186682b061a5a80c3 100644
--- a/chrome/browser/extensions/api/preference/preference_api.cc
+++ b/chrome/browser/extensions/api/preference/preference_api.cc
@@ -7,6 +7,7 @@
#include <stddef.h>
#include <map>
+#include <memory>
#include <utility>
#include "base/lazy_instance.h"
@@ -381,8 +382,6 @@ void PreferenceEventRouter::OnPrefChanged(PrefService* pref_service,
DCHECK(rv);
base::ListValue args;
- base::DictionaryValue* dict = new base::DictionaryValue();
- args.Append(dict);
const PrefService::Preference* pref =
pref_service->FindPreference(browser_pref.c_str());
CHECK(pref);
@@ -396,12 +395,14 @@ void PreferenceEventRouter::OnPrefChanged(PrefService* pref_service,
return;
}
+ std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
dict->Set(keys::kValue, transformed_value);
if (incognito) {
ExtensionPrefs* ep = ExtensionPrefs::Get(profile_);
dict->SetBoolean(keys::kIncognitoSpecific,
ep->HasIncognitoPrefValue(browser_pref));
}
+ args.Append(std::move(dict));
// TODO(kalman): Have a histogram value for each pref type.
// This isn't so important for the current use case of these

Powered by Google App Engine
This is Rietveld 408576698