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

Unified Diff: chrome/browser/browsing_data/browsing_data_remover.cc

Issue 2292443003: Support host-based deletion for SSLHostStateDelegate (Closed)
Patch Set: Created 4 years, 4 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/browsing_data/browsing_data_remover.cc
diff --git a/chrome/browser/browsing_data/browsing_data_remover.cc b/chrome/browser/browsing_data/browsing_data_remover.cc
index cf4f0af778df91208481c01ea16ddb2edd4b9b25..255662ab4d4047ead20097cb67da4055c8d04a5a 100644
--- a/chrome/browser/browsing_data/browsing_data_remover.cc
+++ b/chrome/browser/browsing_data/browsing_data_remover.cc
@@ -633,8 +633,15 @@ void BrowsingDataRemover::RemoveImpl(
// The SSL Host State that tracks SSL interstitial "proceed" decisions may
// include origins that the user has visited, so it must be cleared.
- if (profile_->GetSSLHostStateDelegate())
- profile_->GetSSLHostStateDelegate()->Clear();
+ // TODO(msramek): We can reuse the plugin filter here, since both plugins
+ // and SSL host state are scoped to hosts and represent them as std::string.
+ // Rename the method to indicate its more general usage.
+ if (profile_->GetSSLHostStateDelegate()) {
+ profile_->GetSSLHostStateDelegate()->Clear(
+ filter_builder.IsEmptyBlacklist()
+ ? base::Callback<bool(const std::string&)>()
+ : filter_builder.BuildPluginFilter());
+ }
#if BUILDFLAG(ANDROID_JAVA_UI)
precache::PrecacheManager* precache_manager =
@@ -816,17 +823,17 @@ void BrowsingDataRemover::RemoveImpl(
#endif
if (remove_mask & REMOVE_SITE_USAGE_DATA) {
- ClearSettingsForOneTypeWithPredicate(
- HostContentSettingsMapFactory::GetForProfile(profile_),
- CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT,
- base::Bind(&ForwardPrimaryPatternCallback, same_pattern_filter));
+ HostContentSettingsMapFactory::GetForProfile(profile_)
+ ->ClearSettingsForOneTypeWithPredicate(
+ CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT,
+ base::Bind(&ForwardPrimaryPatternCallback, same_pattern_filter));
}
if (remove_mask & REMOVE_SITE_USAGE_DATA || remove_mask & REMOVE_HISTORY) {
- ClearSettingsForOneTypeWithPredicate(
- HostContentSettingsMapFactory::GetForProfile(profile_),
- CONTENT_SETTINGS_TYPE_APP_BANNER,
- base::Bind(&ForwardPrimaryPatternCallback, same_pattern_filter));
+ HostContentSettingsMapFactory::GetForProfile(profile_)
+ ->ClearSettingsForOneTypeWithPredicate(
+ CONTENT_SETTINGS_TYPE_APP_BANNER,
+ base::Bind(&ForwardPrimaryPatternCallback, same_pattern_filter));
PermissionDecisionAutoBlocker::RemoveCountsByUrl(profile_, filter);
}
@@ -1175,24 +1182,6 @@ BrowsingDataRemover::RemovalTask::RemovalTask(
BrowsingDataRemover::RemovalTask::~RemovalTask() {}
-void BrowsingDataRemover::ClearSettingsForOneTypeWithPredicate(
- HostContentSettingsMap* content_settings_map,
- ContentSettingsType content_type,
- const base::Callback<bool(const ContentSettingsPattern& primary_pattern,
- const ContentSettingsPattern& secondary_pattern)>&
- predicate) {
- ContentSettingsForOneType settings;
- content_settings_map->GetSettingsForOneType(content_type, std::string(),
- &settings);
- for (const ContentSettingPatternSource& setting : settings) {
- if (predicate.Run(setting.primary_pattern, setting.secondary_pattern)) {
- content_settings_map->SetWebsiteSettingCustomScope(
- setting.primary_pattern, setting.secondary_pattern, content_type,
- std::string(), nullptr);
- }
- }
-}
-
bool BrowsingDataRemover::AllDone() {
return !waiting_for_synchronous_clear_operations_ &&
!waiting_for_clear_autofill_origin_urls_ &&

Powered by Google App Engine
This is Rietveld 408576698