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

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

Issue 10898002: Refactor BrowsingDataRemover creation for clarity. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Mac Created 8 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.h
diff --git a/chrome/browser/browsing_data/browsing_data_remover.h b/chrome/browser/browsing_data/browsing_data_remover.h
index 5a1e9f879cdc69e42903523f76d99839a1808261..2e966606b588232a00af3758311c769d5520c37d 100644
--- a/chrome/browser/browsing_data/browsing_data_remover.h
+++ b/chrome/browser/browsing_data/browsing_data_remover.h
@@ -116,15 +116,30 @@ class BrowsingDataRemover : public content::NotificationObserver,
virtual ~Observer() {}
};
- // Creates a BrowsingDataRemover to remove browser data from the specified
- // profile in the specified time range. Use Remove to initiate the removal.
- BrowsingDataRemover(Profile* profile, base::Time delete_begin,
- base::Time delete_end);
+ // Creates a BrowsingDataRemover object that removes data regardless of the
+ // time it was last modified. Returns a raw pointer, as BrowsingDataRemover
+ // retains ownership of itself, and deletes itself once finished.
+ static BrowsingDataRemover* CreateForUnboundedRange(Profile* profile);
+
+ // Creates a BrowsingDataRemover object bound on both sides by a time. Returns
+ // a raw pointer, as BrowsingDataRemover retains ownership of itself, and
+ // deletes itself once finished.
+ static BrowsingDataRemover* CreateForRange(Profile* profile,
+ base::Time delete_begin,
+ base::Time delete_end);
+
+ // Creates a BrowsingDataRemover bound to a specific period of time (as
+ // defined via a TimePeriod). Returns a raw pointer, as BrowsingDataRemover
+ // retains ownership of itself, and deletes itself once finished.
+ static BrowsingDataRemover* CreateForPeriod(Profile* profile,
+ TimePeriod period);
- // Creates a BrowsingDataRemover to remove browser data from the specified
- // profile in the specified time range.
- BrowsingDataRemover(Profile* profile, TimePeriod time_period,
- base::Time delete_end);
+ // Quota managed data uses a different bitmask for types than
+ // BrowsingDataRemover uses. This method generates that mask.
+ static int GenerateQuotaClientMask(int remove_mask);
+
+ // Is the BrowsingDataRemover currently in the process of removing data?
+ static bool is_removing() { return is_removing_; }
// Removes the specified items related to browsing for all origins that match
// the provided |origin_set_mask| (see BrowsingDataHelper::OriginSetMask).
@@ -136,15 +151,9 @@ class BrowsingDataRemover : public content::NotificationObserver,
// Called when history deletion is done.
void OnHistoryDeletionDone();
- // Quota managed data uses a different bitmask for types than
- // BrowsingDataRemover uses. This method generates that mask.
- static int GenerateQuotaClientMask(int remove_mask);
-
// Used for testing.
void OverrideQuotaManagerForTesting(quota::QuotaManager* quota_manager);
- static bool is_removing() { return removing_; }
-
private:
// 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.
@@ -167,6 +176,19 @@ class BrowsingDataRemover : public content::NotificationObserver,
STATE_DONE
};
+ // Calculate the begin time for the deletion range specified by |time_period|.
+ static base::Time CalculateBeginDeleteTime(TimePeriod time_period);
+
+ // Setter for |is_removing_|; DCHECKs that we can only start removing if we're
+ // not already removing, and vice-versa.
+ static void set_removing(bool is_removing);
+
+ // Creates a BrowsingDataRemover to remove browser data from the specified
+ // profile in the specified time range. Use Remove to initiate the removal.
+ BrowsingDataRemover(Profile* profile,
+ base::Time delete_begin,
+ base::Time delete_end);
+
// BrowsingDataRemover deletes itself (using DeleteHelper) and is not supposed
// to be deleted by other objects so make destructor private and DeleteHelper
// a friend.
@@ -286,16 +308,9 @@ class BrowsingDataRemover : public content::NotificationObserver,
// Callback from the above method.
void OnClearedFormData();
- // Calculate the begin time for the deletion range specified by |time_period|.
- base::Time CalculateBeginDeleteTime(TimePeriod time_period);
-
// Returns true if we're all done.
bool AllDone();
- // Setter for removing_; DCHECKs that we can only start removing if we're not
- // already removing, and vice-versa.
- static void set_removing(bool removing);
-
content::NotificationRegistrar registrar_;
// Profile we're to remove from.
@@ -318,7 +333,7 @@ class BrowsingDataRemover : public content::NotificationObserver,
base::Time delete_end_;
// True if Remove has been invoked.
- static bool removing_;
+ static bool is_removing_;
CacheState next_cache_state_;
disk_cache::Backend* cache_;
« no previous file with comments | « chrome/browser/automation/automation_provider.cc ('k') | chrome/browser/browsing_data/browsing_data_remover.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698