| 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_quota_helper_impl.h" | 5 #include "chrome/browser/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" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/common/url_constants.h" | 13 #include "chrome/common/url_constants.h" |
| 14 #include "chrome/browser/browsing_data_helper.h" |
| 14 #include "webkit/quota/quota_manager.h" | 15 #include "webkit/quota/quota_manager.h" |
| 15 | 16 |
| 16 using content::BrowserThread; | 17 using content::BrowserThread; |
| 17 | 18 |
| 18 // static | 19 // static |
| 19 BrowsingDataQuotaHelper* BrowsingDataQuotaHelper::Create(Profile* profile) { | 20 BrowsingDataQuotaHelper* BrowsingDataQuotaHelper::Create(Profile* profile) { |
| 20 return new BrowsingDataQuotaHelperImpl( | 21 return new BrowsingDataQuotaHelperImpl( |
| 21 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 22 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
| 22 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 23 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), |
| 23 content::BrowserContext::GetQuotaManager(profile)); | 24 content::BrowserContext::GetQuotaManager(profile)); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 base::Time(), | 82 base::Time(), |
| 82 base::Bind(&BrowsingDataQuotaHelperImpl::GotOrigins, | 83 base::Bind(&BrowsingDataQuotaHelperImpl::GotOrigins, |
| 83 weak_factory_.GetWeakPtr())); | 84 weak_factory_.GetWeakPtr())); |
| 84 } | 85 } |
| 85 | 86 |
| 86 void BrowsingDataQuotaHelperImpl::GotOrigins( | 87 void BrowsingDataQuotaHelperImpl::GotOrigins( |
| 87 const std::set<GURL>& origins, quota::StorageType type) { | 88 const std::set<GURL>& origins, quota::StorageType type) { |
| 88 for (std::set<GURL>::const_iterator itr = origins.begin(); | 89 for (std::set<GURL>::const_iterator itr = origins.begin(); |
| 89 itr != origins.end(); | 90 itr != origins.end(); |
| 90 ++itr) | 91 ++itr) |
| 91 if (!itr->SchemeIs(chrome::kExtensionScheme)) | 92 if (BrowsingDataHelper::HasValidScheme(*itr)) |
| 92 pending_hosts_.insert(std::make_pair(itr->host(), type)); | 93 pending_hosts_.insert(std::make_pair(itr->host(), type)); |
| 93 | 94 |
| 94 DCHECK(type == quota::kStorageTypeTemporary || | 95 DCHECK(type == quota::kStorageTypeTemporary || |
| 95 type == quota::kStorageTypePersistent); | 96 type == quota::kStorageTypePersistent); |
| 96 | 97 |
| 97 if (type == quota::kStorageTypeTemporary) { | 98 if (type == quota::kStorageTypeTemporary) { |
| 98 quota_manager_->GetOriginsModifiedSince( | 99 quota_manager_->GetOriginsModifiedSince( |
| 99 quota::kStorageTypePersistent, | 100 quota::kStorageTypePersistent, |
| 100 base::Time(), | 101 base::Time(), |
| 101 base::Bind(&BrowsingDataQuotaHelperImpl::GotOrigins, | 102 base::Bind(&BrowsingDataQuotaHelperImpl::GotOrigins, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 callback_.Run(result); | 177 callback_.Run(result); |
| 177 callback_.Reset(); | 178 callback_.Reset(); |
| 178 } | 179 } |
| 179 | 180 |
| 180 void BrowsingDataQuotaHelperImpl::DidRevokeHostQuota( | 181 void BrowsingDataQuotaHelperImpl::DidRevokeHostQuota( |
| 181 quota::QuotaStatusCode status_unused, | 182 quota::QuotaStatusCode status_unused, |
| 182 const std::string& host_unused, | 183 const std::string& host_unused, |
| 183 quota::StorageType type_unused, | 184 quota::StorageType type_unused, |
| 184 int64 quota_unused) { | 185 int64 quota_unused) { |
| 185 } | 186 } |
| OLD | NEW |