| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ | 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ |
| 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ | 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/platform_file.h" |
| 10 #include "webkit/fileapi/file_system_types.h" | 11 #include "webkit/fileapi/file_system_types.h" |
| 11 #include "webkit/quota/special_storage_policy.h" | 12 #include "webkit/quota/special_storage_policy.h" |
| 12 | 13 |
| 13 class FilePath; | 14 class FilePath; |
| 14 class GURL; | 15 class GURL; |
| 15 | 16 |
| 16 namespace base { | 17 namespace base { |
| 17 class MessageLoopProxy; | 18 class MessageLoopProxy; |
| 18 } | 19 } |
| 19 | 20 |
| 20 namespace quota { | 21 namespace quota { |
| 21 class QuotaManagerProxy; | 22 class QuotaManagerProxy; |
| 22 } | 23 } |
| 23 | 24 |
| 24 namespace fileapi { | 25 namespace fileapi { |
| 25 | 26 |
| 26 class ExternalFileSystemMountPointProvider; | 27 class ExternalFileSystemMountPointProvider; |
| 27 class FileSystemCallbackDispatcher; | 28 class FileSystemCallbackDispatcher; |
| 28 class FileSystemContext; | 29 class FileSystemContext; |
| 29 class FileSystemFileUtil; | 30 class FileSystemFileUtil; |
| 30 class FileSystemMountPointProvider; | 31 class FileSystemMountPointProvider; |
| 32 class FileSystemOperationInterface; |
| 31 class FileSystemOptions; | 33 class FileSystemOptions; |
| 32 class FileSystemPathManager; | 34 class FileSystemPathManager; |
| 33 class FileSystemQuotaUtil; | 35 class FileSystemQuotaUtil; |
| 34 class SandboxMountPointProvider; | 36 class SandboxMountPointProvider; |
| 35 | 37 |
| 36 struct DefaultContextDeleter; | 38 struct DefaultContextDeleter; |
| 37 | 39 |
| 38 // This class keeps and provides a file system context for FileSystem API. | 40 // This class keeps and provides a file system context for FileSystem API. |
| 39 // An instance of this class is created and owned by profile. | 41 // An instance of this class is created and owned by profile. |
| 40 class FileSystemContext | 42 class FileSystemContext |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // If |create| is true this may actually set up a filesystem instance | 92 // If |create| is true this may actually set up a filesystem instance |
| 91 // (e.g. by creating the root directory or initializing the database | 93 // (e.g. by creating the root directory or initializing the database |
| 92 // entry etc). | 94 // entry etc). |
| 93 // TODO(kinuko): replace the dispatcher with a regular callback. | 95 // TODO(kinuko): replace the dispatcher with a regular callback. |
| 94 void OpenFileSystem( | 96 void OpenFileSystem( |
| 95 const GURL& origin_url, | 97 const GURL& origin_url, |
| 96 FileSystemType type, | 98 FileSystemType type, |
| 97 bool create, | 99 bool create, |
| 98 scoped_ptr<FileSystemCallbackDispatcher> dispatcher); | 100 scoped_ptr<FileSystemCallbackDispatcher> dispatcher); |
| 99 | 101 |
| 102 // Creates a new FileSystemOperation instance by cracking |
| 103 // the given filesystem URL |url| to get an appropriate MountPointProvider |
| 104 // and calling the provider's corresponding CreateFileSystemOperation method. |
| 105 // The resolved MountPointProvider could perform further specialization |
| 106 // depending on the filesystem type pointed by the |url|. |
| 107 FileSystemOperationInterface* CreateFileSystemOperation( |
| 108 const GURL& url, |
| 109 scoped_ptr<FileSystemCallbackDispatcher> dispatcher, |
| 110 base::MessageLoopProxy* file_proxy); |
| 111 |
| 100 private: | 112 private: |
| 101 friend struct DefaultContextDeleter; | 113 friend struct DefaultContextDeleter; |
| 102 void DeleteOnCorrectThread() const; | 114 void DeleteOnCorrectThread() const; |
| 103 | 115 |
| 104 scoped_refptr<base::MessageLoopProxy> file_message_loop_; | 116 scoped_refptr<base::MessageLoopProxy> file_message_loop_; |
| 105 scoped_refptr<base::MessageLoopProxy> io_message_loop_; | 117 scoped_refptr<base::MessageLoopProxy> io_message_loop_; |
| 106 | 118 |
| 107 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; | 119 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; |
| 108 | 120 |
| 109 // Mount point providers. | 121 // Mount point providers. |
| 110 scoped_ptr<SandboxMountPointProvider> sandbox_provider_; | 122 scoped_ptr<SandboxMountPointProvider> sandbox_provider_; |
| 111 scoped_ptr<ExternalFileSystemMountPointProvider> external_provider_; | 123 scoped_ptr<ExternalFileSystemMountPointProvider> external_provider_; |
| 112 | 124 |
| 113 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemContext); | 125 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemContext); |
| 114 }; | 126 }; |
| 115 | 127 |
| 116 struct DefaultContextDeleter { | 128 struct DefaultContextDeleter { |
| 117 static void Destruct(const FileSystemContext* context) { | 129 static void Destruct(const FileSystemContext* context) { |
| 118 context->DeleteOnCorrectThread(); | 130 context->DeleteOnCorrectThread(); |
| 119 } | 131 } |
| 120 }; | 132 }; |
| 121 | 133 |
| 122 } // namespace fileapi | 134 } // namespace fileapi |
| 123 | 135 |
| 124 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ | 136 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ |
| OLD | NEW |