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

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

Issue 1741123002: Add removal filter support for Cookies, Storage, and Content Settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Android Created 4 years, 8 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.h
diff --git a/chrome/browser/browsing_data/browsing_data_remover.h b/chrome/browser/browsing_data/browsing_data_remover.h
index b5f1a6f18764cbcba7e0d3616431d46a647cc9bb..06a914b2319722359eaab57c61101650ebc6430c 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,7 +21,10 @@
#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/offline_pages/offline_page_model.h"
#include "components/prefs/pref_member.h"
#include "components/search_engines/template_url_service.h"
#include "storage/common/quota/quota_types.h"
@@ -35,7 +39,9 @@
#endif
class BrowsingDataRemoverFactory;
+class HostContentSettingsMap;
class IOThread;
+class BrowsingDataFilterBuilder;
class Profile;
namespace chrome_browser_net {
@@ -250,6 +256,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 BrowsingDataFilterBuilder& origin_filter);
+
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
@@ -266,6 +283,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 +296,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 +338,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 BrowsingDataFilterBuilder& origin_filter,
int origin_type_mask);
// Notifies observers and transitions to the idle state.
@@ -397,7 +428,8 @@ class BrowsingDataRemover : public KeyedService
void OnClearedWebappHistory();
// Callback on UI thread when the offline page data has been cleared.
- void OnClearedOfflinePageData();
+ void OnClearedOfflinePageData(
+ offline_pages::OfflinePageModel::DeletePageResult result);
#endif
void OnClearedDomainReliabilityMonitor();

Powered by Google App Engine
This is Rietveld 408576698