| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/platform_file.h" | 13 #include "base/platform_file.h" |
| 14 #include "webkit/fileapi/file_system_types.h" | 14 #include "webkit/fileapi/file_system_types.h" |
| 15 #include "webkit/quota/special_storage_policy.h" | 15 #include "webkit/quota/special_storage_policy.h" |
| 16 | 16 |
| 17 class FilePath; | 17 class FilePath; |
| 18 class GURL; | 18 class GURL; |
| 19 | 19 |
| 20 namespace base { | 20 namespace base { |
| 21 class MessageLoopProxy; | 21 class MessageLoopProxy; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace quota { | 24 namespace quota { |
| 25 class QuotaManagerProxy; | 25 class QuotaManagerProxy; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace webkit_blob { |
| 29 class FileReader; |
| 30 } |
| 31 |
| 28 namespace fileapi { | 32 namespace fileapi { |
| 29 | 33 |
| 30 class ExternalFileSystemMountPointProvider; | 34 class ExternalFileSystemMountPointProvider; |
| 31 class FileSystemFileUtil; | 35 class FileSystemFileUtil; |
| 32 class FileSystemMountPointProvider; | 36 class FileSystemMountPointProvider; |
| 33 class FileSystemOperationInterface; | 37 class FileSystemOperationInterface; |
| 34 class FileSystemOptions; | 38 class FileSystemOptions; |
| 35 class FileSystemPathManager; | 39 class FileSystemPathManager; |
| 36 class FileSystemQuotaUtil; | 40 class FileSystemQuotaUtil; |
| 37 class IsolatedMountPointProvider; | 41 class IsolatedMountPointProvider; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 111 |
| 108 // Creates a new FileSystemOperation instance by cracking | 112 // Creates a new FileSystemOperation instance by cracking |
| 109 // the given filesystem URL |url| to get an appropriate MountPointProvider | 113 // the given filesystem URL |url| to get an appropriate MountPointProvider |
| 110 // and calling the provider's corresponding CreateFileSystemOperation method. | 114 // and calling the provider's corresponding CreateFileSystemOperation method. |
| 111 // The resolved MountPointProvider could perform further specialization | 115 // The resolved MountPointProvider could perform further specialization |
| 112 // depending on the filesystem type pointed by the |url|. | 116 // depending on the filesystem type pointed by the |url|. |
| 113 FileSystemOperationInterface* CreateFileSystemOperation( | 117 FileSystemOperationInterface* CreateFileSystemOperation( |
| 114 const GURL& url, | 118 const GURL& url, |
| 115 base::MessageLoopProxy* file_proxy); | 119 base::MessageLoopProxy* file_proxy); |
| 116 | 120 |
| 121 // Creates new FileReader instance to read a file pointed by the given |
| 122 // filesystem URL |url| starting from |offset|. |
| 123 // This method internally cracks the |url|, get an appropriate |
| 124 // MountPointProvider for the URL and call the provider's CreateFileReader. |
| 125 // The resolved MountPointProvider could perform further specialization |
| 126 // depending on the filesystem type pointed by the |url|. |
| 127 webkit_blob::FileReader* CreateFileReader( |
| 128 const GURL& url, |
| 129 int64 offset, |
| 130 base::MessageLoopProxy* file_proxy); |
| 131 |
| 117 private: | 132 private: |
| 118 friend struct DefaultContextDeleter; | 133 friend struct DefaultContextDeleter; |
| 119 void DeleteOnCorrectThread() const; | 134 void DeleteOnCorrectThread() const; |
| 120 | 135 |
| 121 scoped_refptr<base::MessageLoopProxy> file_message_loop_; | 136 scoped_refptr<base::MessageLoopProxy> file_message_loop_; |
| 122 scoped_refptr<base::MessageLoopProxy> io_message_loop_; | 137 scoped_refptr<base::MessageLoopProxy> io_message_loop_; |
| 123 | 138 |
| 124 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; | 139 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; |
| 125 | 140 |
| 126 // Mount point providers. | 141 // Mount point providers. |
| 127 scoped_ptr<SandboxMountPointProvider> sandbox_provider_; | 142 scoped_ptr<SandboxMountPointProvider> sandbox_provider_; |
| 128 scoped_ptr<IsolatedMountPointProvider> isolated_provider_; | 143 scoped_ptr<IsolatedMountPointProvider> isolated_provider_; |
| 129 scoped_ptr<ExternalFileSystemMountPointProvider> external_provider_; | 144 scoped_ptr<ExternalFileSystemMountPointProvider> external_provider_; |
| 130 | 145 |
| 131 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemContext); | 146 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemContext); |
| 132 }; | 147 }; |
| 133 | 148 |
| 134 struct DefaultContextDeleter { | 149 struct DefaultContextDeleter { |
| 135 static void Destruct(const FileSystemContext* context) { | 150 static void Destruct(const FileSystemContext* context) { |
| 136 context->DeleteOnCorrectThread(); | 151 context->DeleteOnCorrectThread(); |
| 137 } | 152 } |
| 138 }; | 153 }; |
| 139 | 154 |
| 140 } // namespace fileapi | 155 } // namespace fileapi |
| 141 | 156 |
| 142 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ | 157 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ |
| OLD | NEW |