| 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_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_ |
| 6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 class FileStreamReader; | 42 class FileStreamReader; |
| 43 } | 43 } |
| 44 | 44 |
| 45 namespace fileapi { | 45 namespace fileapi { |
| 46 | 46 |
| 47 class AsyncFileUtil; | 47 class AsyncFileUtil; |
| 48 class CopyOrMoveFileValidatorFactory; | 48 class CopyOrMoveFileValidatorFactory; |
| 49 class ExternalFileSystemBackend; | 49 class ExternalFileSystemBackend; |
| 50 class ExternalMountPoints; | 50 class ExternalMountPoints; |
| 51 class FileStreamWriter; | 51 class FileStreamWriter; |
| 52 class FileSystemBackend; |
| 52 class FileSystemFileUtil; | 53 class FileSystemFileUtil; |
| 53 class FileSystemBackend; | |
| 54 class FileSystemOperation; | 54 class FileSystemOperation; |
| 55 class FileSystemOperationRunner; | 55 class FileSystemOperationRunner; |
| 56 class FileSystemOptions; | 56 class FileSystemOptions; |
| 57 class FileSystemQuotaUtil; | 57 class FileSystemQuotaUtil; |
| 58 class FileSystemURL; | 58 class FileSystemURL; |
| 59 class IsolatedFileSystemBackend; | 59 class IsolatedFileSystemBackend; |
| 60 class MountPoints; | 60 class MountPoints; |
| 61 class SandboxFileSystemBackend; | 61 class SandboxFileSystemBackend; |
| 62 | 62 |
| 63 struct DefaultContextDeleter; | 63 struct DefaultContextDeleter; |
| 64 struct FileSystemInfo; |
| 64 | 65 |
| 65 // This class keeps and provides a file system context for FileSystem API. | 66 // This class keeps and provides a file system context for FileSystem API. |
| 66 // An instance of this class is created and owned by profile. | 67 // An instance of this class is created and owned by profile. |
| 67 class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemContext | 68 class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemContext |
| 68 : public base::RefCountedThreadSafe<FileSystemContext, | 69 : public base::RefCountedThreadSafe<FileSystemContext, |
| 69 DefaultContextDeleter> { | 70 DefaultContextDeleter> { |
| 70 public: | 71 public: |
| 71 // Returns file permission policy we should apply for the given |type|. | 72 // Returns file permission policy we should apply for the given |type|. |
| 72 // The return value must be bitwise-or'd of FilePermissionPolicy. | 73 // The return value must be bitwise-or'd of FilePermissionPolicy. |
| 73 // | 74 // |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 // Returns a FileSystemBackend instance for external filesystem | 148 // Returns a FileSystemBackend instance for external filesystem |
| 148 // type, which is used only by chromeos for now. This is equivalent to | 149 // type, which is used only by chromeos for now. This is equivalent to |
| 149 // calling GetFileSystemBackend(kFileSystemTypeExternal). | 150 // calling GetFileSystemBackend(kFileSystemTypeExternal). |
| 150 ExternalFileSystemBackend* external_backend() const; | 151 ExternalFileSystemBackend* external_backend() const; |
| 151 | 152 |
| 152 // Used for OpenFileSystem. | 153 // Used for OpenFileSystem. |
| 153 typedef base::Callback<void(base::PlatformFileError result, | 154 typedef base::Callback<void(base::PlatformFileError result, |
| 154 const std::string& name, | 155 const std::string& name, |
| 155 const GURL& root)> OpenFileSystemCallback; | 156 const GURL& root)> OpenFileSystemCallback; |
| 156 | 157 |
| 158 // Used for ResolveURL. |
| 159 typedef base::Callback<void(base::PlatformFileError result, |
| 160 const FileSystemInfo& info, |
| 161 const base::FilePath& file_path, |
| 162 bool is_directory)> ResolveURLCallback; |
| 163 |
| 157 // Used for DeleteFileSystem. | 164 // Used for DeleteFileSystem. |
| 158 typedef base::Callback<void(base::PlatformFileError result)> | 165 typedef base::Callback<void(base::PlatformFileError result)> |
| 159 DeleteFileSystemCallback; | 166 DeleteFileSystemCallback; |
| 160 | 167 |
| 161 // Opens the filesystem for the given |origin_url| and |type|, and dispatches | 168 // Opens the filesystem for the given |origin_url| and |type|, and dispatches |
| 162 // |callback| on completion. | 169 // |callback| on completion. |
| 163 // If |create| is true this may actually set up a filesystem instance | 170 // If |create| is true this may actually set up a filesystem instance |
| 164 // (e.g. by creating the root directory or initializing the database | 171 // (e.g. by creating the root directory or initializing the database |
| 165 // entry etc). | 172 // entry etc). |
| 166 void OpenFileSystem( | 173 void OpenFileSystem( |
| 167 const GURL& origin_url, | 174 const GURL& origin_url, |
| 168 FileSystemType type, | 175 FileSystemType type, |
| 169 OpenFileSystemMode mode, | 176 OpenFileSystemMode mode, |
| 170 const OpenFileSystemCallback& callback); | 177 const OpenFileSystemCallback& callback); |
| 171 | 178 |
| 179 // Opens the filesystem for the given |url| as read-only, and then checks the |
| 180 // existence of the file entry referred by the URL. This should be called on |
| 181 // the IO thread. |
| 182 void ResolveURL( |
| 183 const FileSystemURL& url, |
| 184 const ResolveURLCallback& callback); |
| 185 |
| 172 // Deletes the filesystem for the given |origin_url| and |type|. This should | 186 // Deletes the filesystem for the given |origin_url| and |type|. This should |
| 173 // be called on the IO Thread. | 187 // be called on the IO thread. |
| 174 void DeleteFileSystem( | 188 void DeleteFileSystem( |
| 175 const GURL& origin_url, | 189 const GURL& origin_url, |
| 176 FileSystemType type, | 190 FileSystemType type, |
| 177 const DeleteFileSystemCallback& callback); | 191 const DeleteFileSystemCallback& callback); |
| 178 | 192 |
| 179 // Creates new FileStreamReader instance to read a file pointed by the given | 193 // Creates new FileStreamReader instance to read a file pointed by the given |
| 180 // filesystem URL |url| starting from |offset|. |expected_modification_time| | 194 // filesystem URL |url| starting from |offset|. |expected_modification_time| |
| 181 // specifies the expected last modification if the value is non-null, the | 195 // specifies the expected last modification if the value is non-null, the |
| 182 // reader will check the underlying file's actual modification time to see if | 196 // reader will check the underlying file's actual modification time to see if |
| 183 // the file has been modified, and if it does any succeeding read operations | 197 // the file has been modified, and if it does any succeeding read operations |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 // FileSystemURL. | 281 // FileSystemURL. |
| 268 // | 282 // |
| 269 // If the original url does not point to an isolated or external filesystem, | 283 // If the original url does not point to an isolated or external filesystem, |
| 270 // returns the original url, without attempting to crack it. | 284 // returns the original url, without attempting to crack it. |
| 271 FileSystemURL CrackFileSystemURL(const FileSystemURL& url) const; | 285 FileSystemURL CrackFileSystemURL(const FileSystemURL& url) const; |
| 272 | 286 |
| 273 // For initial backend_map construction. This must be called only from | 287 // For initial backend_map construction. This must be called only from |
| 274 // the constructor. | 288 // the constructor. |
| 275 void RegisterBackend(FileSystemBackend* backend); | 289 void RegisterBackend(FileSystemBackend* backend); |
| 276 | 290 |
| 291 void DidOpenFileSystemForResolveURL( |
| 292 const FileSystemURL& url, |
| 293 const ResolveURLCallback& callback, |
| 294 const GURL& filesystem_root, |
| 295 const std::string& filesystem_name, |
| 296 base::PlatformFileError error); |
| 297 |
| 277 // Returns a FileSystemBackend, used only by test code. | 298 // Returns a FileSystemBackend, used only by test code. |
| 278 SandboxFileSystemBackend* sandbox_backend() const { | 299 SandboxFileSystemBackend* sandbox_backend() const { |
| 279 return sandbox_backend_.get(); | 300 return sandbox_backend_.get(); |
| 280 } | 301 } |
| 281 | 302 |
| 282 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 303 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
| 283 scoped_refptr<base::SequencedTaskRunner> default_file_task_runner_; | 304 scoped_refptr<base::SequencedTaskRunner> default_file_task_runner_; |
| 284 | 305 |
| 285 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; | 306 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; |
| 286 | 307 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 | 342 |
| 322 struct DefaultContextDeleter { | 343 struct DefaultContextDeleter { |
| 323 static void Destruct(const FileSystemContext* context) { | 344 static void Destruct(const FileSystemContext* context) { |
| 324 context->DeleteOnCorrectThread(); | 345 context->DeleteOnCorrectThread(); |
| 325 } | 346 } |
| 326 }; | 347 }; |
| 327 | 348 |
| 328 } // namespace fileapi | 349 } // namespace fileapi |
| 329 | 350 |
| 330 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_ | 351 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_ |
| OLD | NEW |