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

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: Created 4 years, 11 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..4b15617ed317a20acf0c20fcc8604472cdd30965 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,19 @@ 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,
michaelpg 2016/02/03 18:39:13 unindent
Finnur 2016/02/04 14:56:58 Done.
+ this)));
+}
+
void StorageInfoFetcher::AddObserver(Observer* observer) {
observers_.AddObserver(observer);
}
@@ -48,6 +63,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());
+}
+
void StorageInfoFetcher::InvokeCallback() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);

Powered by Google App Engine
This is Rietveld 408576698