diff options
Diffstat (limited to 'webkit/fileapi/file_system_quota_manager.cc')
-rw-r--r-- | webkit/fileapi/file_system_quota_manager.cc | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/webkit/fileapi/file_system_quota_manager.cc b/webkit/fileapi/file_system_quota_manager.cc index 13a33f6..69ff706 100644 --- a/webkit/fileapi/file_system_quota_manager.cc +++ b/webkit/fileapi/file_system_quota_manager.cc @@ -8,6 +8,7 @@ #include "base/file_util_proxy.h" #include "base/ref_counted.h" #include "base/scoped_callback_factory.h" +#include "webkit/quota/special_storage_policy.h" namespace fileapi { @@ -15,9 +16,11 @@ const int64 FileSystemQuotaManager::kUnknownSize = -1; FileSystemQuotaManager::FileSystemQuotaManager( bool allow_file_access_from_files, - bool unlimited_quota) + bool unlimited_quota, + quota::SpecialStoragePolicy* special_storage_policy) : allow_file_access_from_files_(allow_file_access_from_files), - unlimited_quota_(unlimited_quota) { + unlimited_quota_(unlimited_quota), + special_storage_policy_(special_storage_policy) { } FileSystemQuotaManager::~FileSystemQuotaManager() {} @@ -26,26 +29,10 @@ bool FileSystemQuotaManager::CheckOriginQuota(const GURL& origin, int64) { // If allow-file-access-from-files flag is explicitly given and the scheme // is file, or if unlimited quota for this process was explicitly requested, // return true. - if (unlimited_quota_ || - (origin.SchemeIsFile() && allow_file_access_from_files_)) - return true; - return CheckIfOriginGrantedUnlimitedQuota(origin); -} - -void FileSystemQuotaManager::SetOriginQuotaUnlimited(const GURL& origin) { - DCHECK(origin == origin.GetOrigin()); - unlimited_quota_origins_.insert(origin); -} - -void FileSystemQuotaManager::ResetOriginQuotaUnlimited(const GURL& origin) { - DCHECK(origin == origin.GetOrigin()); - unlimited_quota_origins_.erase(origin); -} - -bool FileSystemQuotaManager::CheckIfOriginGrantedUnlimitedQuota( - const GURL& origin) { - std::set<GURL>::const_iterator found = unlimited_quota_origins_.find(origin); - return (found != unlimited_quota_origins_.end()); + return unlimited_quota_ || + (allow_file_access_from_files_ && origin.SchemeIsFile()) || + (special_storage_policy_.get() && + special_storage_policy_->IsStorageUnlimited(origin)); } } // namespace fileapi |