summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browsing_data_remover.h
diff options
context:
space:
mode:
authormkwst@chromium.org <mkwst@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-01 16:23:40 +0000
committermkwst@chromium.org <mkwst@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-01 16:23:40 +0000
commit94704173af5f1f377246351d2db3bc5106692df5 (patch)
treedb35e55da44431240ef29d2e8940705f8019f645 /chrome/browser/browsing_data_remover.h
parenta0ae316fef92606969c083f696609516ea7b8e1e (diff)
downloadchromium_src-94704173af5f1f377246351d2db3bc5106692df5.zip
chromium_src-94704173af5f1f377246351d2db3bc5106692df5.tar.gz
chromium_src-94704173af5f1f377246351d2db3bc5106692df5.tar.bz2
Time-based removal of temporary file systems via BrowsingDataRemover
QuotaManager takes over much of the functionality that BrowsingDataRemover implemented for FileSystem and Appcache removal. It also handles WebSQL databases, but I've left the database deletion in, as IndexedDBs aren't yet handled correctly, so we need to take care of them explicitly. BUG=63700 TEST=unit_tests, test_shell_tests Review URL: http://codereview.chromium.org/7129018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94913 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browsing_data_remover.h')
-rw-r--r--chrome/browser/browsing_data_remover.h85
1 files changed, 35 insertions, 50 deletions
diff --git a/chrome/browser/browsing_data_remover.h b/chrome/browser/browsing_data_remover.h
index 9f94024..dc96cc0 100644
--- a/chrome/browser/browsing_data_remover.h
+++ b/chrome/browser/browsing_data_remover.h
@@ -16,6 +16,7 @@
#include "content/browser/cancelable_request.h"
#include "content/common/notification_observer.h"
#include "content/common/notification_registrar.h"
+#include "webkit/quota/quota_types.h"
class ExtensionSpecialStoragePolicy;
class IOThread;
@@ -34,6 +35,10 @@ namespace webkit_database {
class DatabaseTracker;
}
+namespace quota {
+class QuotaManager;
+}
+
// BrowsingDataRemover is responsible for removing data related to browsing:
// visits in url database, downloads, cookies ...
@@ -92,9 +97,6 @@ class BrowsingDataRemover : public NotificationObserver,
static bool is_removing() { return removing_; }
- // Removes the Gears plugin data.
- static void ClearGearsData(const FilePath& profile_dir);
-
private:
enum CacheState {
STATE_NONE,
@@ -143,36 +145,26 @@ class BrowsingDataRemover : public NotificationObserver,
// Performs the actual work to delete the cache.
void DoClearCache(int rv);
- // Callback when HTML5 databases have been deleted. Invokes
- // NotifyAndDeleteIfDone.
- void OnClearedDatabases(int rv);
-
- // Invoked on the FILE thread to delete HTML5 databases.
- void ClearDatabasesOnFILEThread();
+ // Invoked on the IO thread to delete all storage types managed by the quota
+ // system: AppCache, Databases, FileSystems.
+ void ClearQuotaManagedDataOnIOThread();
- // Callback when HTML5 file systems have been cleared. Invokes
- // NotifyAndDeleteIfDone.
- void OnClearedFileSystems();
-
- // Invoked on the FILE thread to delete HTML5 file systems.
- void ClearFileSystemsOnFILEThread();
-
- // Callback when the appcache has been cleared. Invokes
- // NotifyAndDeleteIfDone.
- void OnClearedAppCache();
+ // Callback to respond to QuotaManager::GetOriginsModifiedSince, which is the
+ // core of 'ClearQuotaManagedDataOnIOThread'.
+ void OnGotTemporaryQuotaManagedOrigins(const std::set<GURL>&);
- // Invoked on the IO thread to delete from the AppCache.
- void ClearAppCacheOnIOThread();
+ // Callback to respond to QuotaManager::GetOriginsModifiedSince, which is the
+ // core of `ClearQuotaManagedDataOnIOThread`
+ void OnGotPersistentQuotaManagedOrigins(const std::set<GURL>&);
- // Lower level helpers.
- void OnGotAppCacheInfo(int rv);
- void OnAppCacheDeleted(int rv);
+ // Callback responding to deletion of a single quota managed origin's
+ // persistent data
+ void OnQuotaManagedOriginDeletion(quota::QuotaStatusCode);
- // Callback when Gears data has been deleted. Invokes NotifyAndDeleteIfDone.
- void OnClearedGearsData();
-
- // Invoked on the FILE thread to delete old Gears data.
- void ClearGearsDataOnFILEThread(const FilePath& profile_dir);
+ // Called to check whether all temporary and persistent origin data that
+ // should be deleted has been deleted. If everything's good to go, invokes
+ // NotifyAndDeleteIfDone on the UI thread.
+ void CheckQuotaManagedDataDeletionStatus();
// Calculate the begin time for the deletion range specified by |time_period|.
base::Time CalculateBeginDeleteTime(TimePeriod time_period);
@@ -181,10 +173,9 @@ class BrowsingDataRemover : public NotificationObserver,
bool all_done() {
return registrar_.IsEmpty() && !waiting_for_clear_cache_ &&
!waiting_for_clear_history_ &&
+ !waiting_for_clear_quota_managed_data_ &&
!waiting_for_clear_networking_history_ &&
- !waiting_for_clear_databases_ && !waiting_for_clear_appcache_ &&
- !waiting_for_clear_lso_data_ && !waiting_for_clear_gears_data_ &&
- !waiting_for_clear_file_systems_;
+ !waiting_for_clear_lso_data_;
}
NotificationRegistrar registrar_;
@@ -192,6 +183,10 @@ class BrowsingDataRemover : public NotificationObserver,
// Profile we're to remove from.
Profile* profile_;
+ // The QuotaManager is owned by the profile; we can use a raw pointer here,
+ // and rely on the profile to destroy the object whenever it's reasonable.
+ quota::QuotaManager* quota_manager_;
+
// 'Protected' origins are not subject to data removal.
scoped_refptr<ExtensionSpecialStoragePolicy> special_storage_policy_;
@@ -204,24 +199,12 @@ class BrowsingDataRemover : public NotificationObserver,
// True if Remove has been invoked.
static bool removing_;
- // Reference to database tracker held while deleting databases.
- scoped_refptr<webkit_database::DatabaseTracker> database_tracker_;
-
- net::CompletionCallbackImpl<BrowsingDataRemover> database_cleared_callback_;
- net::CompletionCallbackImpl<BrowsingDataRemover> cache_callback_;
-
- // Used to clear the appcache.
- scoped_refptr<ChromeAppCacheService> appcache_service_;
- net::CompletionCallbackImpl<BrowsingDataRemover> appcache_got_info_callback_;
- net::CompletionCallbackImpl<BrowsingDataRemover> appcache_deleted_callback_;
- scoped_refptr<appcache::AppCacheInfoCollection> appcache_info_;
- int appcaches_to_be_deleted_count_;
-
// Used to delete data from the HTTP caches.
+ net::CompletionCallbackImpl<BrowsingDataRemover> cache_callback_;
CacheState next_cache_state_;
disk_cache::Backend* cache_;
- // Used to delete data from HTTP cache and appcache.
+ // Used to delete data from HTTP cache.
scoped_refptr<net::URLRequestContextGetter> main_context_getter_;
scoped_refptr<net::URLRequestContextGetter> media_context_getter_;
@@ -230,14 +213,16 @@ class BrowsingDataRemover : public NotificationObserver,
base::WaitableEventWatcher watcher_;
// True if we're waiting for various data to be deleted.
- bool waiting_for_clear_databases_;
bool waiting_for_clear_history_;
+ bool waiting_for_clear_quota_managed_data_;
bool waiting_for_clear_networking_history_;
bool waiting_for_clear_cache_;
- bool waiting_for_clear_appcache_;
bool waiting_for_clear_lso_data_;
- bool waiting_for_clear_gears_data_;
- bool waiting_for_clear_file_systems_;
+
+ // Tracking how many origins need to be deleted, and whether we're finished
+ // gathering origins.
+ int quota_managed_origins_to_delete_count_;
+ int quota_managed_storage_types_to_delete_count_;
ObserverList<Observer> observer_list_;