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

Unified Diff: chrome/browser/storage/storage_info_fetcher.cc

Issue 1661533002: Implement deletion of storage per site. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address nits Created 4 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/storage/storage_info_fetcher.cc
diff --git a/chrome/browser/storage/storage_info_fetcher.cc b/chrome/browser/storage/storage_info_fetcher.cc
index adc1d7d33e2e381d8a76c0fce4b4582de9d4eadd..5ff81dcc0cbb2613f37095b05f547b9f808a57bb 100644
--- a/chrome/browser/storage/storage_info_fetcher.cc
+++ b/chrome/browser/storage/storage_info_fetcher.cc
@@ -4,8 +4,10 @@
#include "chrome/browser/storage/storage_info_fetcher.h"
+#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
+using content::BrowserContext;
using content::BrowserThread;
StorageInfoFetcher::StorageInfoFetcher(storage::QuotaManager* quota_manager)
@@ -15,7 +17,7 @@ StorageInfoFetcher::StorageInfoFetcher(storage::QuotaManager* quota_manager)
StorageInfoFetcher::~StorageInfoFetcher() {
}
-void StorageInfoFetcher::Run() {
+void StorageInfoFetcher::FetchStorageInfo() {
// QuotaManager must be called on IO thread, but the callback must then be
// called on the UI thread.
BrowserThread::PostTask(
@@ -24,6 +26,18 @@ void StorageInfoFetcher::Run() {
base::Bind(&StorageInfoFetcher::OnGetUsageInfoInternal, this)));
}
+void StorageInfoFetcher::ClearStorage(
+ const std::string& host, storage::StorageType type) {
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ base::Bind(&storage::QuotaManager::DeleteHostData,
+ quota_manager_,
+ host,
+ type,
+ storage::QuotaClient::kAllClientsMask,
+ base::Bind(&StorageInfoFetcher::OnUsageCleared, this)));
+}
+
void StorageInfoFetcher::AddObserver(Observer* observer) {
observers_.AddObserver(observer);
}
@@ -48,6 +62,12 @@ void StorageInfoFetcher::OnGetUsageInfoInternal(
base::Bind(&StorageInfoFetcher::InvokeCallback, this));
}
+void StorageInfoFetcher::OnUsageCleared(storage::QuotaStatusCode code) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
+
+ FOR_EACH_OBSERVER(Observer, observers_, OnUsageInfoCleared(code));
+}
+
void StorageInfoFetcher::InvokeCallback() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
« no previous file with comments | « chrome/browser/storage/storage_info_fetcher.h ('k') | chrome/browser/ui/webui/settings/site_settings_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698