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

Unified Diff: chrome/browser/extensions/api/font_settings/font_settings_api.cc

Issue 2811673002: Reland: Stop passing raw pointers to base::Value API in c/b/chromeos and c/b/extensions (Closed)
Patch Set: Workaround with std::move 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/api/font_settings/font_settings_api.cc
diff --git a/chrome/browser/extensions/api/font_settings/font_settings_api.cc b/chrome/browser/extensions/api/font_settings/font_settings_api.cc
index b417664a7ef3dd09481fdc5f33497f7f4bf5ef34..b3e2457e5cc9210fb477e05f2c6af6ac9cd1f7c1 100644
--- a/chrome/browser/extensions/api/font_settings/font_settings_api.cc
+++ b/chrome/browser/extensions/api/font_settings/font_settings_api.cc
@@ -15,6 +15,7 @@
#include "base/command_line.h"
#include "base/json/json_writer.h"
#include "base/lazy_instance.h"
+#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
@@ -186,7 +187,7 @@ void FontSettingsEventRouter::OnFontPrefChanged(
base::ListValue args;
std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
- dict->Set(key, pref->GetValue()->DeepCopy());
+ dict->Set(key, pref->GetValue()->CreateDeepCopy());
args.Append(std::move(dict));
extensions::preference_helpers::DispatchEventToExtensions(
@@ -319,8 +320,9 @@ bool FontSettingsGetFontListFunction::CopyFontsToResult(
std::unique_ptr<base::DictionaryValue> font_name(
new base::DictionaryValue());
- font_name->Set(kFontIdKey, new base::Value(name));
- font_name->Set(kDisplayNameKey, new base::Value(localized_name));
+ font_name->Set(kFontIdKey, base::MakeUnique<base::Value>(name));
+ font_name->Set(kDisplayNameKey,
+ base::MakeUnique<base::Value>(localized_name));
result->Append(std::move(font_name));
}
@@ -353,7 +355,7 @@ ExtensionFunction::ResponseAction GetFontPrefExtensionFunction::Run() {
profile, extension_id(), GetPrefName(), kIncognito);
std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue());
- result->Set(GetKey(), pref->GetValue()->DeepCopy());
+ result->Set(GetKey(), pref->GetValue()->CreateDeepCopy());
result->SetString(kLevelOfControlKey, level_of_control);
return RespondNow(OneArgument(std::move(result)));
}

Powered by Google App Engine
This is Rietveld 408576698