| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/browsing_data/browsing_data_quota_helper_impl.h" | 5 #include "chrome/browser/browsing_data/browsing_data_quota_helper_impl.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/barrier_closure.h" | 10 #include "base/barrier_closure.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 BrowserContext::GetDefaultStoragePartition(profile)->GetQuotaManager()); | 29 BrowserContext::GetDefaultStoragePartition(profile)->GetQuotaManager()); |
| 30 } | 30 } |
| 31 | 31 |
| 32 void BrowsingDataQuotaHelperImpl::StartFetching( | 32 void BrowsingDataQuotaHelperImpl::StartFetching( |
| 33 const FetchResultCallback& callback) { | 33 const FetchResultCallback& callback) { |
| 34 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 34 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 35 DCHECK(!callback.is_null()); | 35 DCHECK(!callback.is_null()); |
| 36 | 36 |
| 37 BrowserThread::PostTask( | 37 BrowserThread::PostTask( |
| 38 BrowserThread::IO, FROM_HERE, | 38 BrowserThread::IO, FROM_HERE, |
| 39 base::Bind(&BrowsingDataQuotaHelperImpl::FetchQuotaInfoOnIOThread, this, | 39 base::BindOnce(&BrowsingDataQuotaHelperImpl::FetchQuotaInfoOnIOThread, |
| 40 callback)); | 40 this, callback)); |
| 41 } | 41 } |
| 42 | 42 |
| 43 void BrowsingDataQuotaHelperImpl::RevokeHostQuota(const std::string& host) { | 43 void BrowsingDataQuotaHelperImpl::RevokeHostQuota(const std::string& host) { |
| 44 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 44 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 45 BrowserThread::PostTask( | 45 BrowserThread::PostTask( |
| 46 BrowserThread::IO, FROM_HERE, | 46 BrowserThread::IO, FROM_HERE, |
| 47 base::Bind(&BrowsingDataQuotaHelperImpl::RevokeHostQuotaOnIOThread, this, | 47 base::BindOnce(&BrowsingDataQuotaHelperImpl::RevokeHostQuotaOnIOThread, |
| 48 host)); | 48 this, host)); |
| 49 } | 49 } |
| 50 | 50 |
| 51 BrowsingDataQuotaHelperImpl::BrowsingDataQuotaHelperImpl( | 51 BrowsingDataQuotaHelperImpl::BrowsingDataQuotaHelperImpl( |
| 52 storage::QuotaManager* quota_manager) | 52 storage::QuotaManager* quota_manager) |
| 53 : BrowsingDataQuotaHelper(), | 53 : BrowsingDataQuotaHelper(), |
| 54 quota_manager_(quota_manager), | 54 quota_manager_(quota_manager), |
| 55 weak_factory_(this) { | 55 weak_factory_(this) { |
| 56 DCHECK(quota_manager); | 56 DCHECK(quota_manager); |
| 57 } | 57 } |
| 58 | 58 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 // Skip unused entries | 152 // Skip unused entries |
| 153 if (info.temporary_usage <= 0 && info.persistent_usage <= 0 && | 153 if (info.temporary_usage <= 0 && info.persistent_usage <= 0 && |
| 154 info.syncable_usage <= 0) | 154 info.syncable_usage <= 0) |
| 155 continue; | 155 continue; |
| 156 | 156 |
| 157 info.host = pair.first; | 157 info.host = pair.first; |
| 158 result.push_back(info); | 158 result.push_back(info); |
| 159 } | 159 } |
| 160 | 160 |
| 161 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 161 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 162 base::Bind(callback, result)); | 162 base::BindOnce(callback, result)); |
| 163 } | 163 } |
| 164 | 164 |
| 165 void BrowsingDataQuotaHelperImpl::RevokeHostQuotaOnIOThread( | 165 void BrowsingDataQuotaHelperImpl::RevokeHostQuotaOnIOThread( |
| 166 const std::string& host) { | 166 const std::string& host) { |
| 167 quota_manager_->SetPersistentHostQuota( | 167 quota_manager_->SetPersistentHostQuota( |
| 168 host, 0, base::Bind(&BrowsingDataQuotaHelperImpl::DidRevokeHostQuota, | 168 host, 0, base::Bind(&BrowsingDataQuotaHelperImpl::DidRevokeHostQuota, |
| 169 weak_factory_.GetWeakPtr())); | 169 weak_factory_.GetWeakPtr())); |
| 170 } | 170 } |
| 171 | 171 |
| 172 void BrowsingDataQuotaHelperImpl::DidRevokeHostQuota( | 172 void BrowsingDataQuotaHelperImpl::DidRevokeHostQuota( |
| 173 storage::QuotaStatusCode /*status*/, | 173 storage::QuotaStatusCode /*status*/, |
| 174 int64_t /*quota*/) {} | 174 int64_t /*quota*/) {} |
| OLD | NEW |