Index: components/content_settings/core/browser/content_settings_pref.cc |
diff --git a/components/content_settings/core/browser/content_settings_pref.cc b/components/content_settings/core/browser/content_settings_pref.cc |
index f32e3018b4cc0828d4b5b7efa7a596d5f022d82b..d69ca377baf183593456e5549016f9b1e492667d 100644 |
--- a/components/content_settings/core/browser/content_settings_pref.cc |
+++ b/components/content_settings/core/browser/content_settings_pref.cc |
@@ -5,11 +5,14 @@ |
#include "components/content_settings/core/browser/content_settings_pref.h" |
#include <memory> |
+#include <utility> |
#include "base/auto_reset.h" |
#include "base/bind.h" |
+#include "base/memory/ptr_util.h" |
#include "base/metrics/histogram_macros.h" |
#include "base/strings/string_split.h" |
+#include "base/values.h" |
#include "components/content_settings/core/browser/content_settings_info.h" |
#include "components/content_settings/core/browser/content_settings_registry.h" |
#include "components/content_settings/core/browser/content_settings_rule.h" |
@@ -339,9 +342,10 @@ void ContentSettingsPref::UpdatePref( |
pattern_str, &settings_dictionary); |
if (!found && value) { |
- settings_dictionary = new base::DictionaryValue; |
pattern_pairs_settings->SetWithoutPathExpansion( |
- pattern_str, settings_dictionary); |
+ pattern_str, base::MakeUnique<base::DictionaryValue>()); |
+ pattern_pairs_settings->GetDictionaryWithoutPathExpansion( |
+ pattern_str, &settings_dictionary); |
} |
if (settings_dictionary) { |
@@ -366,16 +370,16 @@ void ContentSettingsPref::UpdatePref( |
kPerResourceIdentifierPrefName, NULL); |
} |
} else { |
- resource_dictionary->SetWithoutPathExpansion( |
- resource_identifier, value->DeepCopy()); |
+ resource_dictionary->SetWithoutPathExpansion(resource_identifier, |
+ value->CreateDeepCopy()); |
} |
} else { |
// Update settings dictionary. |
if (value == NULL) { |
settings_dictionary->RemoveWithoutPathExpansion(kSettingPath, NULL); |
} else { |
- settings_dictionary->SetWithoutPathExpansion( |
- kSettingPath, value->DeepCopy()); |
+ settings_dictionary->SetWithoutPathExpansion(kSettingPath, |
+ value->CreateDeepCopy()); |
} |
} |
// Remove the settings dictionary if it is empty. |
@@ -439,7 +443,7 @@ void ContentSettingsPref::CanonicalizeContentSettingsExceptions( |
all_settings_dictionary->RemoveWithoutPathExpansion( |
move_items[i].first, &pattern_settings_dictionary); |
all_settings_dictionary->SetWithoutPathExpansion( |
- move_items[i].second, pattern_settings_dictionary.release()); |
+ move_items[i].second, std::move(pattern_settings_dictionary)); |
} |
} |