Chromium Code Reviews| Index: webkit/fileapi/file_system_context.cc |
| diff --git a/webkit/fileapi/file_system_context.cc b/webkit/fileapi/file_system_context.cc |
| index a88afcefc0e262e7bf5b7ddfd6b42ca8597e4ed4..3e69095308132dece0667d349220463dc31a098a 100644 |
| --- a/webkit/fileapi/file_system_context.cc |
| +++ b/webkit/fileapi/file_system_context.cc |
| @@ -7,23 +7,32 @@ |
| #include "base/file_util.h" |
| #include "base/message_loop_proxy.h" |
| #include "googleurl/src/gurl.h" |
| -#include "webkit/fileapi/file_system_path_manager.h" |
| +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFileSystem.h" |
| +#include "webkit/fileapi/file_system_file_util.h" |
| +#include "webkit/fileapi/file_system_options.h" |
| +#include "webkit/fileapi/file_system_quota_client.h" |
| #include "webkit/fileapi/file_system_util.h" |
| #include "webkit/fileapi/sandbox_mount_point_provider.h" |
| -#include "webkit/fileapi/file_system_quota_client.h" |
| #include "webkit/quota/quota_manager.h" |
| +#include "webkit/quota/special_storage_policy.h" |
| + |
| +#if defined(OS_CHROMEOS) |
| +#include "webkit/chromeos/fileapi/cros_mount_point_provider.h" |
| +#endif |
| using quota::QuotaClient; |
| namespace fileapi { |
| namespace { |
| + |
| QuotaClient* CreateQuotaClient( |
| scoped_refptr<base::MessageLoopProxy> file_message_loop, |
| FileSystemContext* context, |
| bool is_incognito) { |
| return new FileSystemQuotaClient(file_message_loop, context, is_incognito); |
| } |
| + |
| } // anonymous namespace |
| FileSystemContext::FileSystemContext( |
| @@ -32,22 +41,23 @@ FileSystemContext::FileSystemContext( |
| scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy, |
| quota::QuotaManagerProxy* quota_manager_proxy, |
| const FilePath& profile_path, |
| - bool is_incognito, |
| - bool allow_file_access_from_files, |
| - FileSystemPathManager* path_manager) |
| + const FileSystemOptions& options) |
| : file_message_loop_(file_message_loop), |
| io_message_loop_(io_message_loop), |
| quota_manager_proxy_(quota_manager_proxy), |
| - path_manager_(path_manager) { |
| - if (!path_manager) { |
| - path_manager_.reset(new FileSystemPathManager( |
| - file_message_loop, profile_path, special_storage_policy, |
| - is_incognito, allow_file_access_from_files)); |
| - } |
| + sandbox_provider_( |
| + new SandboxMountPointProvider( |
| + file_message_loop, |
| + profile_path, |
| + options)) { |
| if (quota_manager_proxy) { |
| quota_manager_proxy->RegisterClient(CreateQuotaClient( |
| - file_message_loop, this, is_incognito)); |
| + file_message_loop, this, options.is_incognito())); |
| } |
| +#if defined(OS_CHROMEOS) |
| + external_provider_.reset( |
| + new chromeos::CrosMountPointProvider(special_storage_policy)); |
| +#endif |
| } |
| FileSystemContext::~FileSystemContext() { |
| @@ -88,6 +98,40 @@ FileSystemContext::GetQuotaUtil(FileSystemType type) const { |
| return NULL; |
| } |
| +FileSystemFileUtil* FileSystemContext::GetFileUtil( |
| + FileSystemType type) const { |
| + FileSystemMountPointProvider* mount_point_provider = |
| + GetMountPointProvider(type); |
| + if (!mount_point_provider) |
|
ericu
2012/01/03 22:34:24
You removed a DCHECK(mount_point_provider). Shoul
kinuko
2012/01/05 09:40:18
I found this could be NULL in a pepper testing cod
|
| + return NULL; |
| + return mount_point_provider->GetFileUtil(); |
| +} |
| + |
| +FileSystemMountPointProvider* FileSystemContext::GetMountPointProvider( |
| + FileSystemType type) const { |
| + switch (type) { |
| + case kFileSystemTypeTemporary: |
| + case kFileSystemTypePersistent: |
| + return sandbox_provider_.get(); |
| + case kFileSystemTypeExternal: |
| + return external_provider_.get(); |
| + case kFileSystemTypeUnknown: |
| + default: |
| + NOTREACHED(); |
| + return NULL; |
| + } |
| +} |
| + |
| +SandboxMountPointProvider* |
| +FileSystemContext::sandbox_provider() const { |
| + return sandbox_provider_.get(); |
| +} |
| + |
| +ExternalFileSystemMountPointProvider* |
| +FileSystemContext::external_provider() const { |
| + return external_provider_.get(); |
| +} |
| + |
| void FileSystemContext::DeleteOnCorrectThread() const { |
| if (!io_message_loop_->BelongsToCurrentThread()) { |
| io_message_loop_->DeleteSoon(FROM_HERE, this); |
| @@ -96,8 +140,11 @@ void FileSystemContext::DeleteOnCorrectThread() const { |
| delete this; |
| } |
| -SandboxMountPointProvider* FileSystemContext::sandbox_provider() const { |
| - return path_manager_->sandbox_provider(); |
| -} |
| - |
| } // namespace fileapi |
| + |
| +COMPILE_ASSERT(int(WebKit::WebFileSystem::TypeTemporary) == \ |
| + int(fileapi::kFileSystemTypeTemporary), mismatching_enums); |
| +COMPILE_ASSERT(int(WebKit::WebFileSystem::TypePersistent) == \ |
| + int(fileapi::kFileSystemTypePersistent), mismatching_enums); |
| +COMPILE_ASSERT(int(WebKit::WebFileSystem::TypeExternal) == \ |
| + int(fileapi::kFileSystemTypeExternal), mismatching_enums); |