Chromium Code Reviews| 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/bind.h" | 10 #include "base/bind.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 void BrowsingDataQuotaHelperImpl::RevokeHostQuota(const std::string& host) { | 42 void BrowsingDataQuotaHelperImpl::RevokeHostQuota(const std::string& host) { |
| 43 if (!io_thread_->BelongsToCurrentThread()) { | 43 if (!io_thread_->BelongsToCurrentThread()) { |
| 44 io_thread_->PostTask( | 44 io_thread_->PostTask( |
| 45 FROM_HERE, | 45 FROM_HERE, |
| 46 base::Bind(&BrowsingDataQuotaHelperImpl::RevokeHostQuota, this, host)); | 46 base::Bind(&BrowsingDataQuotaHelperImpl::RevokeHostQuota, this, host)); |
| 47 return; | 47 return; |
| 48 } | 48 } |
| 49 | 49 |
| 50 quota_manager_->SetPersistentHostQuota( | 50 quota_manager_->SetPersistentHostQuota( |
| 51 host, 0, | 51 host, 0, |
| 52 base::Bind(&BrowsingDataQuotaHelperImpl::DidRevokeHostQuota, | 52 base::Bind(&BrowsingDataQuotaHelperImpl::DidRevokeHostQuota, |
|
kinuko
2012/09/18 12:03:56
DidRevokeHostQuota doesn't seem to check host or t
calvinlo
2012/09/19 03:15:38
Done.
| |
| 53 weak_factory_.GetWeakPtr())); | 53 weak_factory_.GetWeakPtr(), host, |
| 54 quota::kStorageTypePersistent)); | |
| 54 } | 55 } |
| 55 | 56 |
| 56 BrowsingDataQuotaHelperImpl::BrowsingDataQuotaHelperImpl( | 57 BrowsingDataQuotaHelperImpl::BrowsingDataQuotaHelperImpl( |
| 57 base::MessageLoopProxy* ui_thread, | 58 base::MessageLoopProxy* ui_thread, |
| 58 base::MessageLoopProxy* io_thread, | 59 base::MessageLoopProxy* io_thread, |
| 59 quota::QuotaManager* quota_manager) | 60 quota::QuotaManager* quota_manager) |
| 60 : BrowsingDataQuotaHelper(io_thread), | 61 : BrowsingDataQuotaHelper(io_thread), |
| 61 quota_manager_(quota_manager), | 62 quota_manager_(quota_manager), |
| 62 is_fetching_(false), | 63 is_fetching_(false), |
| 63 ui_thread_(ui_thread), | 64 ui_thread_(ui_thread), |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 pending_hosts_.erase(itr); | 119 pending_hosts_.erase(itr); |
| 119 GetHostUsage(host, type); | 120 GetHostUsage(host, type); |
| 120 } | 121 } |
| 121 | 122 |
| 122 void BrowsingDataQuotaHelperImpl::GetHostUsage(const std::string& host, | 123 void BrowsingDataQuotaHelperImpl::GetHostUsage(const std::string& host, |
| 123 quota::StorageType type) { | 124 quota::StorageType type) { |
| 124 DCHECK(quota_manager_.get()); | 125 DCHECK(quota_manager_.get()); |
| 125 quota_manager_->GetHostUsage( | 126 quota_manager_->GetHostUsage( |
| 126 host, type, | 127 host, type, |
| 127 base::Bind(&BrowsingDataQuotaHelperImpl::GotHostUsage, | 128 base::Bind(&BrowsingDataQuotaHelperImpl::GotHostUsage, |
| 128 weak_factory_.GetWeakPtr())); | 129 weak_factory_.GetWeakPtr(), host, type)); |
| 129 } | 130 } |
| 130 | 131 |
| 131 void BrowsingDataQuotaHelperImpl::GotHostUsage(const std::string& host, | 132 void BrowsingDataQuotaHelperImpl::GotHostUsage(const std::string& host, |
| 132 quota::StorageType type, | 133 quota::StorageType type, |
| 133 int64 usage) { | 134 int64 usage) { |
| 134 switch (type) { | 135 switch (type) { |
| 135 case quota::kStorageTypeTemporary: | 136 case quota::kStorageTypeTemporary: |
| 136 quota_info_[host].temporary_usage = usage; | 137 quota_info_[host].temporary_usage = usage; |
| 137 break; | 138 break; |
| 138 case quota::kStorageTypePersistent: | 139 case quota::kStorageTypePersistent: |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 167 | 168 |
| 168 info->host = itr->first; | 169 info->host = itr->first; |
| 169 result.push_back(*info); | 170 result.push_back(*info); |
| 170 } | 171 } |
| 171 | 172 |
| 172 callback_.Run(result); | 173 callback_.Run(result); |
| 173 callback_.Reset(); | 174 callback_.Reset(); |
| 174 } | 175 } |
| 175 | 176 |
| 176 void BrowsingDataQuotaHelperImpl::DidRevokeHostQuota( | 177 void BrowsingDataQuotaHelperImpl::DidRevokeHostQuota( |
| 177 quota::QuotaStatusCode status_unused, | |
| 178 const std::string& host_unused, | 178 const std::string& host_unused, |
| 179 quota::StorageType type_unused, | 179 quota::StorageType type_unused, |
| 180 quota::QuotaStatusCode status_unused, | |
| 180 int64 quota_unused) { | 181 int64 quota_unused) { |
| 181 } | 182 } |
| OLD | NEW |