| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 } | 142 } |
| 143 | 143 |
| 144 void BrowsingDataQuotaHelperImpl::OnGetHostsUsageComplete( | 144 void BrowsingDataQuotaHelperImpl::OnGetHostsUsageComplete( |
| 145 const FetchResultCallback& callback, | 145 const FetchResultCallback& callback, |
| 146 QuotaInfoMap* quota_info) { | 146 QuotaInfoMap* quota_info) { |
| 147 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 147 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 148 | 148 |
| 149 QuotaInfoArray result; | 149 QuotaInfoArray result; |
| 150 for (auto& pair : *quota_info) { | 150 for (auto& pair : *quota_info) { |
| 151 QuotaInfo& info = pair.second; | 151 QuotaInfo& info = pair.second; |
| 152 // Skip unused entries | |
| 153 if (info.temporary_usage <= 0 && info.persistent_usage <= 0 && | 152 if (info.temporary_usage <= 0 && info.persistent_usage <= 0 && |
| 154 info.syncable_usage <= 0) | 153 info.syncable_usage <= 0) { |
| 155 continue; | 154 continue; |
| 156 | 155 } |
| 157 info.host = pair.first; | 156 info.host = pair.first; |
| 158 result.push_back(info); | 157 result.push_back(info); |
| 159 } | 158 } |
| 160 | 159 |
| 161 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 160 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 162 base::Bind(callback, result)); | 161 base::Bind(callback, result)); |
| 163 } | 162 } |
| 164 | 163 |
| 165 void BrowsingDataQuotaHelperImpl::RevokeHostQuotaOnIOThread( | 164 void BrowsingDataQuotaHelperImpl::RevokeHostQuotaOnIOThread( |
| 166 const std::string& host) { | 165 const std::string& host) { |
| 167 quota_manager_->SetPersistentHostQuota( | 166 quota_manager_->SetPersistentHostQuota( |
| 168 host, 0, base::Bind(&BrowsingDataQuotaHelperImpl::DidRevokeHostQuota, | 167 host, 0, base::Bind(&BrowsingDataQuotaHelperImpl::DidRevokeHostQuota, |
| 169 weak_factory_.GetWeakPtr())); | 168 weak_factory_.GetWeakPtr())); |
| 170 } | 169 } |
| 171 | 170 |
| 172 void BrowsingDataQuotaHelperImpl::DidRevokeHostQuota( | 171 void BrowsingDataQuotaHelperImpl::DidRevokeHostQuota( |
| 173 storage::QuotaStatusCode /*status*/, | 172 storage::QuotaStatusCode /*status*/, |
| 174 int64_t /*quota*/) {} | 173 int64_t /*quota*/) {} |
| OLD | NEW |