Chromium Code Reviews| 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_context.h" | 5 #include "webkit/fileapi/file_system_context.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/message_loop_proxy.h" | 8 #include "base/message_loop_proxy.h" |
| 9 #include "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
| 10 #include "webkit/fileapi/file_system_path_manager.h" | 10 #include "webkit/fileapi/file_system_path_manager.h" |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 special_storage_policy_(special_storage_policy), | 26 special_storage_policy_(special_storage_policy), |
| 27 allow_file_access_from_files_(allow_file_access), | 27 allow_file_access_from_files_(allow_file_access), |
| 28 unlimited_quota_(unlimited_quota), | 28 unlimited_quota_(unlimited_quota), |
| 29 path_manager_(new FileSystemPathManager( | 29 path_manager_(new FileSystemPathManager( |
| 30 file_message_loop, profile_path, special_storage_policy, is_incognito, | 30 file_message_loop, profile_path, special_storage_policy, is_incognito, |
| 31 allow_file_access)), | 31 allow_file_access)), |
| 32 usage_tracker_(new FileSystemUsageTracker( | 32 usage_tracker_(new FileSystemUsageTracker( |
| 33 file_message_loop, profile_path, is_incognito)) { | 33 file_message_loop, profile_path, is_incognito)) { |
| 34 } | 34 } |
| 35 | 35 |
| 36 FileSystemContext::FileSystemContext( | |
| 37 scoped_refptr<base::MessageLoopProxy> file_message_loop, | |
| 38 scoped_refptr<base::MessageLoopProxy> io_message_loop, | |
| 39 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy, | |
| 40 const FilePath& profile_path, | |
| 41 bool is_incognito, | |
| 42 bool allow_file_access, | |
| 43 bool unlimited_quota, | |
| 44 FileSystemPathManager* path_manager) | |
| 45 : file_message_loop_(file_message_loop), | |
| 46 io_message_loop_(io_message_loop), | |
| 47 special_storage_policy_(special_storage_policy), | |
| 48 allow_file_access_from_files_(allow_file_access), | |
| 49 unlimited_quota_(unlimited_quota), | |
| 50 path_manager_(path_manager), | |
| 51 usage_tracker_(new FileSystemUsageTracker( | |
| 52 file_message_loop, profile_path, is_incognito)) { | |
|
ericu
2011/04/19 20:30:49
How about passing in an path_manager that may be n
zel
2011/04/19 23:14:00
Done.
| |
| 53 } | |
| 54 | |
| 36 FileSystemContext::~FileSystemContext() { | 55 FileSystemContext::~FileSystemContext() { |
| 37 } | 56 } |
| 38 | 57 |
| 39 bool FileSystemContext::IsStorageUnlimited(const GURL& origin) { | 58 bool FileSystemContext::IsStorageUnlimited(const GURL& origin) { |
| 40 // If allow-file-access-from-files flag is explicitly given and the scheme | 59 // If allow-file-access-from-files flag is explicitly given and the scheme |
| 41 // is file, or if unlimited quota for this process was explicitly requested, | 60 // is file, or if unlimited quota for this process was explicitly requested, |
| 42 // return true. | 61 // return true. |
| 43 return unlimited_quota_ || | 62 return unlimited_quota_ || |
| 44 (allow_file_access_from_files_ && origin.SchemeIsFile()) || | 63 (allow_file_access_from_files_ && origin.SchemeIsFile()) || |
| 45 (special_storage_policy_.get() && | 64 (special_storage_policy_.get() && |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 59 file_util::Delete(path_for_origin, true /* recursive */); | 78 file_util::Delete(path_for_origin, true /* recursive */); |
| 60 } | 79 } |
| 61 | 80 |
| 62 void FileSystemContext::DeleteOnCorrectThread() const { | 81 void FileSystemContext::DeleteOnCorrectThread() const { |
| 63 if (!io_message_loop_->BelongsToCurrentThread()) { | 82 if (!io_message_loop_->BelongsToCurrentThread()) { |
| 64 io_message_loop_->DeleteSoon(FROM_HERE, this); | 83 io_message_loop_->DeleteSoon(FROM_HERE, this); |
| 65 return; | 84 return; |
| 66 } | 85 } |
| 67 delete this; | 86 delete this; |
| 68 } | 87 } |
| 69 | 88 |
|
ericu
2011/04/19 20:30:49
Extra line.
zel
2011/04/19 23:14:00
Done.
| |
| 89 | |
| 70 SandboxMountPointProvider* FileSystemContext::sandbox_provider() const { | 90 SandboxMountPointProvider* FileSystemContext::sandbox_provider() const { |
| 71 return path_manager_->sandbox_provider(); | 91 return path_manager_->sandbox_provider(); |
| 72 } | 92 } |
| 73 | 93 |
| 74 } // namespace fileapi | 94 } // namespace fileapi |
| OLD | NEW |