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

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

Issue 2651123002: Migrate content setting PROMPT_NO_DECISION_COUNT to PERMISSION_AUTOBLOCKER_DATA (Closed)
Patch Set: Rename pref Created 3 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_provider.cc
diff --git a/components/content_settings/core/browser/content_settings_pref_provider.cc b/components/content_settings/core/browser/content_settings_pref_provider.cc
index 33c52f9d0e1886e171ebf40d668de1b6a6c72442..e544e4f004ab7b794e3833153de6863a4d872d80 100644
--- a/components/content_settings/core/browser/content_settings_pref_provider.cc
+++ b/components/content_settings/core/browser/content_settings_pref_provider.cc
@@ -227,6 +227,29 @@ void PrefProvider::DiscardObsoletePreferences() {
prefs_->ClearPref(kObsoleteMouseLockExceptionsPref);
#endif // !defined(OS_ANDROID)
#endif // !defined(OS_IOS)
+
+#if !defined(OS_IOS)
+ // Migrate CONTENT_SETTINGS_TYPE_PROMPT_NO_DECISION_COUNT to
+ // CONTENT_SETTINGS_TYPE_PERMISSION_AUTOBLOCKER_DATA.
+ // TODO(raymes): See crbug.com/681709. Remove after M60.
+ const std::string prompt_no_decision_count_pref =
+ WebsiteSettingsRegistry::GetInstance()
+ ->Get(CONTENT_SETTINGS_TYPE_PROMPT_NO_DECISION_COUNT)
+ ->pref_name();
+ const base::DictionaryValue* old_dict =
+ prefs_->GetDictionary(prompt_no_decision_count_pref);
+
+ const std::string permission_autoblocker_data_pref =
+ WebsiteSettingsRegistry::GetInstance()
+ ->Get(CONTENT_SETTINGS_TYPE_PERMISSION_AUTOBLOCKER_DATA)
+ ->pref_name();
+ const base::DictionaryValue* new_dict =
+ prefs_->GetDictionary(permission_autoblocker_data_pref);
+
+ if (!old_dict->empty() && new_dict->empty())
+ prefs_->Set(permission_autoblocker_data_pref, *old_dict);
+ prefs_->ClearPref(prompt_no_decision_count_pref);
+#endif // !defined(OS_IOS)
}
} // namespace content_settings

Powered by Google App Engine
This is Rietveld 408576698