| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "webkit/fileapi/file_system_quota.h" | 5 #include "webkit/fileapi/file_system_quota.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/file_util_proxy.h" | 8 #include "base/file_util_proxy.h" |
| 9 #include "base/ref_counted.h" | 9 #include "base/ref_counted.h" |
| 10 #include "base/scoped_callback_factory.h" | 10 #include "base/scoped_callback_factory.h" |
| 11 | 11 |
| 12 namespace fileapi { | 12 namespace fileapi { |
| 13 | 13 |
| 14 const int64 FileSystemQuota::kUnknownSize = -1; | 14 const int64 FileSystemQuota::kUnknownSize = -1; |
| 15 | 15 |
| 16 FileSystemQuota::FileSystemQuota() {} |
| 17 |
| 18 FileSystemQuota::~FileSystemQuota() {} |
| 19 |
| 16 bool FileSystemQuota::CheckOriginQuota(const GURL& origin, int64) { | 20 bool FileSystemQuota::CheckOriginQuota(const GURL& origin, int64) { |
| 17 return CheckIfOriginGrantedUnlimitedQuota(origin); | 21 return CheckIfOriginGrantedUnlimitedQuota(origin); |
| 18 } | 22 } |
| 19 | 23 |
| 20 void FileSystemQuota::SetOriginQuotaUnlimited(const GURL& origin) { | 24 void FileSystemQuota::SetOriginQuotaUnlimited(const GURL& origin) { |
| 21 DCHECK(origin == origin.GetOrigin()); | 25 DCHECK(origin == origin.GetOrigin()); |
| 22 unlimited_quota_origins_.insert(origin); | 26 unlimited_quota_origins_.insert(origin); |
| 23 } | 27 } |
| 24 | 28 |
| 25 void FileSystemQuota::ResetOriginQuotaUnlimited(const GURL& origin) { | 29 void FileSystemQuota::ResetOriginQuotaUnlimited(const GURL& origin) { |
| 26 DCHECK(origin == origin.GetOrigin()); | 30 DCHECK(origin == origin.GetOrigin()); |
| 27 unlimited_quota_origins_.erase(origin); | 31 unlimited_quota_origins_.erase(origin); |
| 28 } | 32 } |
| 29 | 33 |
| 30 bool FileSystemQuota::CheckIfOriginGrantedUnlimitedQuota(const GURL& origin) { | 34 bool FileSystemQuota::CheckIfOriginGrantedUnlimitedQuota(const GURL& origin) { |
| 31 std::set<GURL>::const_iterator found = unlimited_quota_origins_.find(origin); | 35 std::set<GURL>::const_iterator found = unlimited_quota_origins_.find(origin); |
| 32 return (found != unlimited_quota_origins_.end()); | 36 return (found != unlimited_quota_origins_.end()); |
| 33 } | 37 } |
| 34 | 38 |
| 35 } // namespace fileapi | 39 } // namespace fileapi |
| OLD | NEW |