| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_QUOTA_MANAGER_H_ | |
| 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_QUOTA_MANAGER_H_ | |
| 7 | |
| 8 #include <set> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/ref_counted.h" | |
| 12 #include "googleurl/src/gurl.h" | |
| 13 | |
| 14 namespace quota { | |
| 15 class SpecialStoragePolicy; | |
| 16 } | |
| 17 | |
| 18 namespace fileapi { | |
| 19 | |
| 20 // A quota manager for FileSystem. For now it has little implementation | |
| 21 // and just allows unlimited quota for apps. | |
| 22 class FileSystemQuotaManager { | |
| 23 public: | |
| 24 static const int64 kUnknownSize; | |
| 25 | |
| 26 // If |allow_file_access_from_files| is true, unlimited access is granted | |
| 27 // for file:/// URLs. | |
| 28 // If |unlimited_quota| is true, unlimited access is granted for every | |
| 29 // origin. This flag must be used only for testing. | |
| 30 FileSystemQuotaManager(bool allow_file_access_from_files, | |
| 31 bool unlimited_quota, | |
| 32 quota::SpecialStoragePolicy* special_storage_policy); | |
| 33 ~FileSystemQuotaManager(); | |
| 34 | |
| 35 // Checks if the origin can grow its usage by |growth| bytes. | |
| 36 // This only performs in-memory check and returns immediately. | |
| 37 // For now it just returns false for any origins (regardless of the size) | |
| 38 // that are not in the in-memory unlimited_quota_origins map. | |
| 39 bool CheckOriginQuota(const GURL& origin, int64 growth); | |
| 40 | |
| 41 private: | |
| 42 // For some extensions/apps we allow unlimited quota. | |
| 43 std::set<GURL> unlimited_quota_origins_; | |
| 44 | |
| 45 const bool allow_file_access_from_files_; | |
| 46 const bool unlimited_quota_; | |
| 47 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; | |
| 48 | |
| 49 DISALLOW_COPY_AND_ASSIGN(FileSystemQuotaManager); | |
| 50 }; | |
| 51 | |
| 52 } // namespace fileapi | |
| 53 | |
| 54 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_QUOTA_MANAGER_H_ | |
| OLD | NEW |