Index: chrome/browser/browsing_data/browsing_data_remover.h |
diff --git a/chrome/browser/browsing_data/browsing_data_remover.h b/chrome/browser/browsing_data/browsing_data_remover.h |
index f0c74328aad0f069b8360c8883c0968a44263e5b..261d3e9743d55ad3b69215ac54d57e697c88ead5 100644 |
--- a/chrome/browser/browsing_data/browsing_data_remover.h |
+++ b/chrome/browser/browsing_data/browsing_data_remover.h |
@@ -9,6 +9,7 @@ |
#include <set> |
+#include "base/callback_forward.h" |
#include "base/gtest_prod_util.h" |
#include "base/macros.h" |
#include "base/memory/ref_counted.h" |
@@ -20,6 +21,8 @@ |
#include "base/time/time.h" |
#include "build/build_config.h" |
#include "chrome/common/features.h" |
+#include "components/content_settings/core/common/content_settings_pattern.h" |
+#include "components/content_settings/core/common/content_settings_types.h" |
#include "components/keyed_service/core/keyed_service.h" |
#include "components/prefs/pref_member.h" |
#include "components/search_engines/template_url_service.h" |
@@ -35,7 +38,9 @@ |
#endif |
class BrowsingDataRemoverFactory; |
+class HostContentSettingsMap; |
class IOThread; |
+class OriginFilterBuilder; |
class Profile; |
namespace chrome_browser_net { |
@@ -246,6 +251,17 @@ class BrowsingDataRemover : public KeyedService |
int remove_mask, |
int origin_type_mask); |
+ // Removes the specified items related to browsing for all origins that match |
+ // the provided |origin_type_mask| (see BrowsingDataHelper::OriginTypeMask). |
+ // The |origin_filter| is used as a final filter for clearing operations. |
+ // TODO(dmurph): Support all backends with filter (crbug.com/113621). |
+ // DO NOT USE THIS METHOD UNLESS CALLER KNOWS WHAT THEY'RE DOING. NOT ALL |
+ // BACKENDS ARE SUPPORTED YET, AND MORE DATA THAN EXPECTED COULD BE DELETED. |
+ void RemoveWithFilter(const TimeRange& time_range, |
+ int remove_mask, |
+ int origin_type_mask, |
+ const OriginFilterBuilder& origin_filter); |
+ |
void AddObserver(Observer* observer); |
void RemoveObserver(Observer* observer); |
@@ -257,6 +273,8 @@ class BrowsingDataRemover : public KeyedService |
// The clear API needs to be able to toggle removing_ in order to test that |
// only one BrowsingDataRemover instance can be called at a time. |
FRIEND_TEST_ALL_PREFIXES(ExtensionBrowsingDataTest, OneAtATime); |
+ // Testing our static method, ClearSettingsForOneTypeWithPredicate. |
+ FRIEND_TEST_ALL_PREFIXES(BrowsingDataRemoverTest, ClearWithPredicate); |
// The BrowsingDataRemover tests need to be able to access the implementation |
// of Remove(), as it exposes details that aren't yet available in the public |
@@ -268,6 +286,17 @@ class BrowsingDataRemover : public KeyedService |
friend class BrowsingDataRemoverFactory; |
+ // Clears all host-specific settings for one content type that satisfy the |
+ // given predicate. |
+ // |
+ // This should only be called on the UI thread. |
+ static void ClearSettingsForOneTypeWithPredicate( |
+ HostContentSettingsMap* content_settings_map, |
+ ContentSettingsType content_type, |
+ const base::Callback< |
+ bool(const ContentSettingsPattern& primary_pattern, |
+ const ContentSettingsPattern& secondary_pattern)>& predicate); |
+ |
// Use BrowsingDataRemoverFactory::GetForBrowserContext to get an instance of |
// this class. |
BrowsingDataRemover(content::BrowserContext* browser_context); |
@@ -299,14 +328,15 @@ class BrowsingDataRemover : public KeyedService |
// Removes the specified items related to browsing for a specific host. If the |
// provided |remove_url| is empty, data is removed for all origins; otherwise, |
- // it is restricted by origin (where implemented yet). The |
+ // it is restricted by the origin filter origin (where implemented yet). The |
// |origin_type_mask| parameter defines the set of origins from which data |
// should be removed (protected, unprotected, or both). |
// TODO(ttr314): Remove "(where implemented yet)" constraint above once |
// crbug.com/113621 is done. |
+ // TODO(crbug.com/589586): Support all backends w/ origin filter. |
void RemoveImpl(const TimeRange& time_range, |
int remove_mask, |
- const GURL& remove_url, |
+ const OriginFilterBuilder& origin_filter, |
int origin_type_mask); |
// Notifies observers and transitions to the idle state. |