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

Unified Diff: components/content_settings/core/browser/content_settings_pref.cc

Issue 1605453003: Ensure content settings aren't persisted in the guest profile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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: 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 762cb621b62ad15d29f070b292d28bc9c4200644..61451522c52ab7be542512b2933e17dd12443b7e 100644
--- a/components/content_settings/core/browser/content_settings_pref.cc
+++ b/components/content_settings/core/browser/content_settings_pref.cc
@@ -143,27 +143,32 @@ bool ContentSettingsPref::SetWebsiteSetting(
return true;
}
-void ContentSettingsPref::ClearAllContentSettingsRules() {
+void ContentSettingsPref::ClearPref() {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(prefs_);
- OriginIdentifierValueMap* map_to_modify = &incognito_value_map_;
- if (!is_incognito_)
- map_to_modify = &value_map_;
-
{
base::AutoLock auto_lock(lock_);
- map_to_modify->clear();
+ value_map_.clear();
}
- if (!is_incognito_) {
- // Clear the preference.
- {
- base::AutoReset<bool> auto_reset(&updating_preferences_, true);
- DictionaryPrefUpdate update(prefs_, pref_name_);
- base::DictionaryValue* pattern_pairs_settings = update.Get();
- pattern_pairs_settings->Clear();
- }
+ {
+ base::AutoReset<bool> auto_reset(&updating_preferences_, true);
+ DictionaryPrefUpdate update(prefs_, pref_name_);
+ base::DictionaryValue* pattern_pairs_settings = update.Get();
+ pattern_pairs_settings->Clear();
+ }
+}
+
+void ContentSettingsPref::ClearAllContentSettingsRules() {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK(prefs_);
+
+ if (is_incognito_) {
+ base::AutoLock auto_lock(lock_);
+ incognito_value_map_.clear();
+ } else {
+ ClearPref();
}
notify_callback_.Run(ContentSettingsPattern(),

Powered by Google App Engine
This is Rietveld 408576698