Chromium Code Reviews| 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 b5f1a6f18764cbcba7e0d3616431d46a647cc9bb..281a8c5e35e5d1b62d0be1d1662436cfcd2810ee 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 BrowsingDataRemoverFilter; |
| class Profile; |
| namespace chrome_browser_net { |
| @@ -250,6 +255,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. |
|
kinuko
2016/04/07 09:03:08
Phew...
|
| + void RemoveWithFilter(const TimeRange& time_range, |
| + int remove_mask, |
| + int origin_type_mask, |
| + const BrowsingDataRemoverFilter& origin_filter); |
| + |
| void AddObserver(Observer* observer); |
| void RemoveObserver(Observer* observer); |
| @@ -266,6 +282,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 |
| @@ -277,6 +295,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); |
| @@ -308,14 +337,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 BrowsingDataRemoverFilter& origin_filter, |
| int origin_type_mask); |
| // Notifies observers and transitions to the idle state. |