| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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; |
| 28 class FileSystemCallbackDispatcher; |
| 27 class FileSystemContext; | 29 class FileSystemContext; |
| 28 class FileSystemFileUtil; | 30 class FileSystemFileUtil; |
| 29 class FileSystemMountPointProvider; | 31 class FileSystemMountPointProvider; |
| 30 class FileSystemOptions; | 32 class FileSystemOptions; |
| 31 class FileSystemPathManager; | 33 class FileSystemPathManager; |
| 32 class FileSystemQuotaUtil; | 34 class FileSystemQuotaUtil; |
| 33 class SandboxMountPointProvider; | 35 class SandboxMountPointProvider; |
| 34 | 36 |
| 35 struct DefaultContextDeleter; | 37 struct DefaultContextDeleter; |
| 36 | 38 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 // Returns a FileSystemMountPointProvider instance for sandboxed filesystem | 80 // Returns a FileSystemMountPointProvider instance for sandboxed filesystem |
| 79 // types (e.g. TEMPORARY or PERSISTENT). This is equivalent to calling | 81 // types (e.g. TEMPORARY or PERSISTENT). This is equivalent to calling |
| 80 // GetMountPointProvider(kFileSystemType{Temporary, Persistent}). | 82 // GetMountPointProvider(kFileSystemType{Temporary, Persistent}). |
| 81 SandboxMountPointProvider* sandbox_provider() const; | 83 SandboxMountPointProvider* sandbox_provider() const; |
| 82 | 84 |
| 83 // Returns a FileSystemMountPointProvider instance for external filesystem | 85 // Returns a FileSystemMountPointProvider instance for external filesystem |
| 84 // type, which is used only by chromeos for now. This is equivalent to | 86 // type, which is used only by chromeos for now. This is equivalent to |
| 85 // calling GetMountPointProvider(kFileSystemTypeExternal). | 87 // calling GetMountPointProvider(kFileSystemTypeExternal). |
| 86 ExternalFileSystemMountPointProvider* external_provider() const; | 88 ExternalFileSystemMountPointProvider* external_provider() const; |
| 87 | 89 |
| 90 // Opens the filesystem for the given origin and type and dispatches |
| 91 // the DidOpenFileSystem callback of the given |dispatcher|. |
| 92 // If |create| is true this may actually setup a filesystem instance |
| 93 // (e.g. by creating the root directory or initializing the database |
| 94 // entry etc). |
| 95 // TODO(kinuko): replace the dispatcher with regular callback. |
| 96 void OpenFileSystem( |
| 97 const GURL& origin_url, |
| 98 FileSystemType type, |
| 99 bool create, |
| 100 FileSystemCallbackDispatcher* dispatcher); |
| 101 |
| 88 private: | 102 private: |
| 89 friend struct DefaultContextDeleter; | 103 friend struct DefaultContextDeleter; |
| 90 void DeleteOnCorrectThread() const; | 104 void DeleteOnCorrectThread() const; |
| 91 | 105 |
| 92 scoped_refptr<base::MessageLoopProxy> file_message_loop_; | 106 scoped_refptr<base::MessageLoopProxy> file_message_loop_; |
| 93 scoped_refptr<base::MessageLoopProxy> io_message_loop_; | 107 scoped_refptr<base::MessageLoopProxy> io_message_loop_; |
| 94 | 108 |
| 95 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; | 109 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; |
| 96 | 110 |
| 97 // Mount point providers. | 111 // Mount point providers. |
| 98 scoped_ptr<SandboxMountPointProvider> sandbox_provider_; | 112 scoped_ptr<SandboxMountPointProvider> sandbox_provider_; |
| 99 scoped_ptr<ExternalFileSystemMountPointProvider> external_provider_; | 113 scoped_ptr<ExternalFileSystemMountPointProvider> external_provider_; |
| 100 | 114 |
| 101 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemContext); | 115 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemContext); |
| 102 }; | 116 }; |
| 103 | 117 |
| 104 struct DefaultContextDeleter { | 118 struct DefaultContextDeleter { |
| 105 static void Destruct(const FileSystemContext* context) { | 119 static void Destruct(const FileSystemContext* context) { |
| 106 context->DeleteOnCorrectThread(); | 120 context->DeleteOnCorrectThread(); |
| 107 } | 121 } |
| 108 }; | 122 }; |
| 109 | 123 |
| 110 } // namespace fileapi | 124 } // namespace fileapi |
| 111 | 125 |
| 112 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ | 126 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ |
| OLD | NEW |