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

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

Issue 2697123004: Convert RemoveDataMask from enum to pointers and split it between content and embedder (Closed)
Patch Set: Android compilation Created 3 years, 10 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 335844db3a6a8095e331224a777b6b2953969082..52c896130f627125b0e70087d4ce268e62ecf6cb 100644
--- a/chrome/browser/browsing_data/browsing_data_remover.h
+++ b/chrome/browser/browsing_data/browsing_data_remover.h
@@ -6,13 +6,16 @@
#define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_
#include <memory>
+#include <set>
+
#include "base/callback_forward.h"
#include "base/time/time.h"
-#include "build/build_config.h"
#include "chrome/browser/browsing_data/browsing_data_remover_delegate.h"
+#include "content/public/browser/browsing_data_types.h"
namespace content {
class BrowsingDataFilterBuilder;
+struct BrowsingDataType;
}
////////////////////////////////////////////////////////////////////////////////
@@ -52,87 +55,6 @@ class BrowsingDataFilterBuilder;
// data deletion. Use PluginDataRemover instead.
class BrowsingDataRemover {
public:
- // Mask used for Remove.
- enum RemoveDataMask {
- REMOVE_APPCACHE = 1 << 0,
- REMOVE_CACHE = 1 << 1,
- REMOVE_COOKIES = 1 << 2,
- REMOVE_DOWNLOADS = 1 << 3,
- REMOVE_FILE_SYSTEMS = 1 << 4,
- REMOVE_FORM_DATA = 1 << 5,
- // In addition to visits, REMOVE_HISTORY removes keywords, last session and
- // passwords UI statistics.
- REMOVE_HISTORY = 1 << 6,
- REMOVE_INDEXEDDB = 1 << 7,
- REMOVE_LOCAL_STORAGE = 1 << 8,
- REMOVE_PLUGIN_DATA = 1 << 9,
- REMOVE_PASSWORDS = 1 << 10,
- REMOVE_WEBSQL = 1 << 11,
- REMOVE_CHANNEL_IDS = 1 << 12,
- REMOVE_MEDIA_LICENSES = 1 << 13,
- REMOVE_SERVICE_WORKERS = 1 << 14,
- REMOVE_SITE_USAGE_DATA = 1 << 15,
- // REMOVE_NOCHECKS intentionally does not check if the browser context is
- // prohibited from deleting history or downloads.
- REMOVE_NOCHECKS = 1 << 16,
- REMOVE_CACHE_STORAGE = 1 << 17,
-#if defined(OS_ANDROID)
- REMOVE_WEBAPP_DATA = 1 << 18,
-#endif
- REMOVE_DURABLE_PERMISSION = 1 << 19,
- REMOVE_EXTERNAL_PROTOCOL_DATA = 1 << 20,
-
- // The following flag is used only in tests. In normal usage, hosted app
- // data is controlled by the REMOVE_COOKIES flag, applied to the
- // protected-web origin.
- REMOVE_HOSTED_APP_DATA_TESTONLY = 1 << 31,
-
- // "Site data" includes cookies, appcache, file systems, indexedDBs, local
- // storage, webSQL, service workers, cache storage, plugin data, web app
- // data (on Android) and statistics about passwords.
- REMOVE_SITE_DATA = REMOVE_APPCACHE | REMOVE_COOKIES | REMOVE_FILE_SYSTEMS |
- REMOVE_INDEXEDDB |
- REMOVE_LOCAL_STORAGE |
- REMOVE_PLUGIN_DATA |
- REMOVE_SERVICE_WORKERS |
- REMOVE_CACHE_STORAGE |
- REMOVE_WEBSQL |
- REMOVE_CHANNEL_IDS |
-#if defined(OS_ANDROID)
- REMOVE_WEBAPP_DATA |
-#endif
- REMOVE_SITE_USAGE_DATA |
- REMOVE_DURABLE_PERMISSION |
- REMOVE_EXTERNAL_PROTOCOL_DATA,
-
- // Datatypes protected by Important Sites.
- IMPORTANT_SITES_DATATYPES = REMOVE_SITE_DATA | REMOVE_CACHE,
-
- // Datatypes that can be deleted partially per URL / origin / domain,
- // whichever makes sense.
- FILTERABLE_DATATYPES = REMOVE_SITE_DATA | REMOVE_CACHE | REMOVE_DOWNLOADS,
-
- // Includes all the available remove options. Meant to be used by clients
- // that wish to wipe as much data as possible from a Profile, to make it
- // look like a new Profile.
- REMOVE_ALL = REMOVE_SITE_DATA | REMOVE_CACHE | REMOVE_DOWNLOADS |
- REMOVE_FORM_DATA |
- REMOVE_HISTORY |
- REMOVE_PASSWORDS |
- REMOVE_MEDIA_LICENSES,
-
- // Includes all available remove options. Meant to be used when the Profile
- // is scheduled to be deleted, and all possible data should be wiped from
- // disk as soon as possible.
- REMOVE_WIPE_PROFILE = REMOVE_ALL | REMOVE_NOCHECKS,
- };
-
- // Important sites protect a small set of sites from the deletion of certain
- // datatypes. Therefore, those datatypes must be filterable by
- // url/origin/domain.
- static_assert(0 == (IMPORTANT_SITES_DATATYPES & ~FILTERABLE_DATATYPES),
- "All important sites datatypes must be filterable.");
-
// A helper enum to report the deletion of cookies and/or cache. Do not
// reorder the entries, as this enum is passed to UMA.
enum CookieOrCacheDeletionChoice {
@@ -162,18 +84,20 @@ class BrowsingDataRemover {
// Removes browsing data within the given |time_range|, with datatypes being
// specified by |remove_mask| and origin types by |origin_type_mask|.
- virtual void Remove(const base::Time& delete_begin,
- const base::Time& delete_end,
- int remove_mask,
- int origin_type_mask) = 0;
+ virtual void Remove(
+ const base::Time& delete_begin,
+ const base::Time& delete_end,
+ const std::set<const content::BrowsingDataType*>& remove_mask,
+ int origin_type_mask) = 0;
// A version of the above that in addition informs the |observer| when the
// removal task is finished.
- virtual void RemoveAndReply(const base::Time& delete_begin,
- const base::Time& delete_end,
- int remove_mask,
- int origin_type_mask,
- Observer* observer) = 0;
+ virtual void RemoveAndReply(
+ const base::Time& delete_begin,
+ const base::Time& delete_end,
+ const std::set<const content::BrowsingDataType*>& remove_mask,
+ int origin_type_mask,
+ Observer* observer) = 0;
// Like Remove(), but in case of URL-keyed only removes data whose URL match
// |filter_builder| (e.g. are on certain origin or domain).
@@ -181,7 +105,7 @@ class BrowsingDataRemover {
virtual void RemoveWithFilter(
const base::Time& delete_begin,
const base::Time& delete_end,
- int remove_mask,
+ const std::set<const content::BrowsingDataType*>& remove_mask,
int origin_type_mask,
std::unique_ptr<content::BrowsingDataFilterBuilder> filter_builder) = 0;
@@ -190,7 +114,7 @@ class BrowsingDataRemover {
virtual void RemoveWithFilterAndReply(
const base::Time& delete_begin,
const base::Time& delete_end,
- int remove_mask,
+ const std::set<const content::BrowsingDataType*>& remove_mask,
int origin_type_mask,
std::unique_ptr<content::BrowsingDataFilterBuilder> filter_builder,
Observer* observer) = 0;
@@ -207,7 +131,8 @@ class BrowsingDataRemover {
// the tests to record the parameters using GMock instead.
virtual const base::Time& GetLastUsedBeginTime() = 0;
virtual const base::Time& GetLastUsedEndTime() = 0;
- virtual int GetLastUsedRemovalMask() = 0;
+ virtual const std::set<const content::BrowsingDataType*>&
+ GetLastUsedRemovalMask() = 0;
virtual int GetLastUsedOriginTypeMask() = 0;
};

Powered by Google App Engine
This is Rietveld 408576698