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

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

Issue 2292443003: Support host-based deletion for SSLHostStateDelegate (Closed)
Patch Set: Rebase. Created 4 years, 3 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 1867e0faa49e45e4cc89c7260225ee6d1248196d..0d7759b32ad1d65c1dd11698cbadb225af1a160e 100644
--- a/chrome/browser/browsing_data/browsing_data_remover.cc
+++ b/chrome/browser/browsing_data/browsing_data_remover.cc
@@ -667,8 +667,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 =
@@ -850,17 +857,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);
}
@@ -1225,24 +1232,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_ &&
« no previous file with comments | « chrome/browser/browsing_data/browsing_data_remover.h ('k') | chrome/browser/browsing_data/browsing_data_remover_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698