| 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);
|
|
|
|
|