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

Unified Diff: chrome/browser/plugins/plugin_prefs.cc

Issue 2000803003: Use std::unique_ptr for base::DictionaryValue and base::ListValue's internal store. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More fixes 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/plugins/plugin_prefs.cc
diff --git a/chrome/browser/plugins/plugin_prefs.cc b/chrome/browser/plugins/plugin_prefs.cc
index 8d45ae4bc09d7f20f8c4f798ae5f20969a8231b3..6995dc913a155362c4ba740a06728a27c3babdb7 100644
--- a/chrome/browser/plugins/plugin_prefs.cc
+++ b/chrome/browser/plugins/plugin_prefs.cc
@@ -333,14 +333,13 @@ void PluginPrefs::SetPrefs(PrefService* prefs) {
ListPrefUpdate update(prefs_, prefs::kPluginsPluginsList);
base::ListValue* saved_plugins_list = update.Get();
if (saved_plugins_list && !saved_plugins_list->empty()) {
- for (base::Value* plugin_value : *saved_plugins_list) {
- if (!plugin_value->IsType(base::Value::TYPE_DICTIONARY)) {
+ for (const auto& plugin_value : *saved_plugins_list) {
+ base::DictionaryValue* plugin;
+ if (!plugin_value->GetAsDictionary(&plugin)) {
LOG(WARNING) << "Invalid entry in " << prefs::kPluginsPluginsList;
continue; // Oops, don't know what to do with this item.
}
- base::DictionaryValue* plugin =
- static_cast<base::DictionaryValue*>(plugin_value);
base::string16 group_name;
bool enabled;
if (!plugin->GetBoolean("enabled", &enabled))
« no previous file with comments | « chrome/browser/permissions/chooser_context_base.cc ('k') | chrome/browser/policy/managed_bookmarks_policy_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698