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 #include "webkit/fileapi/file_system_quota_manager.h" | |
6 | |
7 #include "base/file_path.h" | |
8 #include "base/file_util_proxy.h" | |
9 #include "base/ref_counted.h" | |
10 #include "base/scoped_callback_factory.h" | |
11 #include "webkit/quota/special_storage_policy.h" | |
12 | |
13 namespace fileapi { | |
14 | |
15 const int64 FileSystemQuotaManager::kUnknownSize = -1; | |
16 | |
17 FileSystemQuotaManager::FileSystemQuotaManager( | |
18 bool allow_file_access_from_files, | |
19 bool unlimited_quota, | |
20 quota::SpecialStoragePolicy* special_storage_policy) | |
21 : allow_file_access_from_files_(allow_file_access_from_files), | |
22 unlimited_quota_(unlimited_quota), | |
23 special_storage_policy_(special_storage_policy) { | |
24 } | |
25 | |
26 FileSystemQuotaManager::~FileSystemQuotaManager() {} | |
27 | |
28 bool FileSystemQuotaManager::CheckOriginQuota(const GURL& origin, int64) { | |
29 // If allow-file-access-from-files flag is explicitly given and the scheme | |
30 // is file, or if unlimited quota for this process was explicitly requested, | |
31 // return true. | |
32 return unlimited_quota_ || | |
33 (allow_file_access_from_files_ && origin.SchemeIsFile()) || | |
34 (special_storage_policy_.get() && | |
35 special_storage_policy_->IsStorageUnlimited(origin)); | |
36 } | |
37 | |
38 } // namespace fileapi | |
OLD | NEW |