| 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 15 matching lines...) Expand all Loading... |
| 26 namespace base { | 26 namespace base { |
| 27 class FilePath; | 27 class FilePath; |
| 28 class SequencedTaskRunner; | 28 class SequencedTaskRunner; |
| 29 class SingleThreadTaskRunner; | 29 class SingleThreadTaskRunner; |
| 30 } | 30 } |
| 31 | 31 |
| 32 namespace chrome { | 32 namespace chrome { |
| 33 class NativeMediaFileUtilTest; | 33 class NativeMediaFileUtilTest; |
| 34 } | 34 } |
| 35 | 35 |
| 36 namespace quota { | 36 namespace storage { |
| 37 class QuotaManagerProxy; | 37 class QuotaManagerProxy; |
| 38 class SpecialStoragePolicy; | 38 class SpecialStoragePolicy; |
| 39 } | 39 } |
| 40 | 40 |
| 41 namespace net { | 41 namespace net { |
| 42 class URLRequest; | 42 class URLRequest; |
| 43 } | 43 } |
| 44 | 44 |
| 45 namespace webkit_blob { | 45 namespace storage { |
| 46 class BlobURLRequestJobTest; | 46 class BlobURLRequestJobTest; |
| 47 class FileStreamReader; | 47 class FileStreamReader; |
| 48 } | 48 } |
| 49 | 49 |
| 50 namespace fileapi { | 50 namespace storage { |
| 51 | 51 |
| 52 class AsyncFileUtil; | 52 class AsyncFileUtil; |
| 53 class CopyOrMoveFileValidatorFactory; | 53 class CopyOrMoveFileValidatorFactory; |
| 54 class ExternalFileSystemBackend; | 54 class ExternalFileSystemBackend; |
| 55 class ExternalMountPoints; | 55 class ExternalMountPoints; |
| 56 class FileStreamWriter; | 56 class FileStreamWriter; |
| 57 class FileSystemBackend; | 57 class FileSystemBackend; |
| 58 class FileSystemFileUtil; | 58 class FileSystemFileUtil; |
| 59 class FileSystemOperation; | 59 class FileSystemOperation; |
| 60 class FileSystemOperationRunner; | 60 class FileSystemOperationRunner; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 // If none is given, this context only handles HTML5 Sandbox FileSystem | 112 // If none is given, this context only handles HTML5 Sandbox FileSystem |
| 113 // and Drag-and-drop Isolated FileSystem requests. | 113 // and Drag-and-drop Isolated FileSystem requests. |
| 114 // | 114 // |
| 115 // |auto_mount_handlers| are used to resolve calls to | 115 // |auto_mount_handlers| are used to resolve calls to |
| 116 // AttemptAutoMountForURLRequest. Only external filesystems are auto mounted | 116 // AttemptAutoMountForURLRequest. Only external filesystems are auto mounted |
| 117 // when a filesystem: URL request is made. | 117 // when a filesystem: URL request is made. |
| 118 FileSystemContext( | 118 FileSystemContext( |
| 119 base::SingleThreadTaskRunner* io_task_runner, | 119 base::SingleThreadTaskRunner* io_task_runner, |
| 120 base::SequencedTaskRunner* file_task_runner, | 120 base::SequencedTaskRunner* file_task_runner, |
| 121 ExternalMountPoints* external_mount_points, | 121 ExternalMountPoints* external_mount_points, |
| 122 quota::SpecialStoragePolicy* special_storage_policy, | 122 storage::SpecialStoragePolicy* special_storage_policy, |
| 123 quota::QuotaManagerProxy* quota_manager_proxy, | 123 storage::QuotaManagerProxy* quota_manager_proxy, |
| 124 ScopedVector<FileSystemBackend> additional_backends, | 124 ScopedVector<FileSystemBackend> additional_backends, |
| 125 const std::vector<URLRequestAutoMountHandler>& auto_mount_handlers, | 125 const std::vector<URLRequestAutoMountHandler>& auto_mount_handlers, |
| 126 const base::FilePath& partition_path, | 126 const base::FilePath& partition_path, |
| 127 const FileSystemOptions& options); | 127 const FileSystemOptions& options); |
| 128 | 128 |
| 129 bool DeleteDataForOriginOnFileTaskRunner(const GURL& origin_url); | 129 bool DeleteDataForOriginOnFileTaskRunner(const GURL& origin_url); |
| 130 | 130 |
| 131 // Creates a new QuotaReservation for the given |origin_url| and |type|. | 131 // Creates a new QuotaReservation for the given |origin_url| and |type|. |
| 132 // Returns NULL if |type| does not support quota or reservation fails. | 132 // Returns NULL if |type| does not support quota or reservation fails. |
| 133 // This should be run on |default_file_task_runner_| and the returned value | 133 // This should be run on |default_file_task_runner_| and the returned value |
| 134 // should be destroyed on the runner. | 134 // should be destroyed on the runner. |
| 135 scoped_refptr<QuotaReservation> CreateQuotaReservationOnFileTaskRunner( | 135 scoped_refptr<QuotaReservation> CreateQuotaReservationOnFileTaskRunner( |
| 136 const GURL& origin_url, | 136 const GURL& origin_url, |
| 137 FileSystemType type); | 137 FileSystemType type); |
| 138 | 138 |
| 139 quota::QuotaManagerProxy* quota_manager_proxy() const { | 139 storage::QuotaManagerProxy* quota_manager_proxy() const { |
| 140 return quota_manager_proxy_.get(); | 140 return quota_manager_proxy_.get(); |
| 141 } | 141 } |
| 142 | 142 |
| 143 // Discards inflight operations in the operation runner. | 143 // Discards inflight operations in the operation runner. |
| 144 void Shutdown(); | 144 void Shutdown(); |
| 145 | 145 |
| 146 // Returns a quota util for a given filesystem type. This may | 146 // Returns a quota util for a given filesystem type. This may |
| 147 // return NULL if the type does not support the usage tracking or | 147 // return NULL if the type does not support the usage tracking or |
| 148 // it is not a quota-managed storage. | 148 // it is not a quota-managed storage. |
| 149 FileSystemQuotaUtil* GetQuotaUtil(FileSystemType type) const; | 149 FileSystemQuotaUtil* GetQuotaUtil(FileSystemType type) const; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 // Creates new FileStreamReader instance to read a file pointed by the given | 239 // Creates new FileStreamReader instance to read a file pointed by the given |
| 240 // filesystem URL |url| starting from |offset|. |expected_modification_time| | 240 // filesystem URL |url| starting from |offset|. |expected_modification_time| |
| 241 // specifies the expected last modification if the value is non-null, the | 241 // specifies the expected last modification if the value is non-null, the |
| 242 // reader will check the underlying file's actual modification time to see if | 242 // reader will check the underlying file's actual modification time to see if |
| 243 // the file has been modified, and if it does any succeeding read operations | 243 // the file has been modified, and if it does any succeeding read operations |
| 244 // should fail with ERR_UPLOAD_FILE_CHANGED error. | 244 // should fail with ERR_UPLOAD_FILE_CHANGED error. |
| 245 // This method internally cracks the |url|, get an appropriate | 245 // This method internally cracks the |url|, get an appropriate |
| 246 // FileSystemBackend for the URL and call the backend's CreateFileReader. | 246 // FileSystemBackend for the URL and call the backend's CreateFileReader. |
| 247 // The resolved FileSystemBackend could perform further specialization | 247 // The resolved FileSystemBackend could perform further specialization |
| 248 // depending on the filesystem type pointed by the |url|. | 248 // depending on the filesystem type pointed by the |url|. |
| 249 scoped_ptr<webkit_blob::FileStreamReader> CreateFileStreamReader( | 249 scoped_ptr<storage::FileStreamReader> CreateFileStreamReader( |
| 250 const FileSystemURL& url, | 250 const FileSystemURL& url, |
| 251 int64 offset, | 251 int64 offset, |
| 252 const base::Time& expected_modification_time); | 252 const base::Time& expected_modification_time); |
| 253 | 253 |
| 254 // Creates new FileStreamWriter instance to write into a file pointed by | 254 // Creates new FileStreamWriter instance to write into a file pointed by |
| 255 // |url| from |offset|. | 255 // |url| from |offset|. |
| 256 scoped_ptr<FileStreamWriter> CreateFileStreamWriter( | 256 scoped_ptr<FileStreamWriter> CreateFileStreamWriter( |
| 257 const FileSystemURL& url, | 257 const FileSystemURL& url, |
| 258 int64 offset); | 258 int64 offset); |
| 259 | 259 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 } | 364 } |
| 365 | 365 |
| 366 // Used only by test code. | 366 // Used only by test code. |
| 367 PluginPrivateFileSystemBackend* plugin_private_backend() const { | 367 PluginPrivateFileSystemBackend* plugin_private_backend() const { |
| 368 return plugin_private_backend_.get(); | 368 return plugin_private_backend_.get(); |
| 369 } | 369 } |
| 370 | 370 |
| 371 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 371 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
| 372 scoped_refptr<base::SequencedTaskRunner> default_file_task_runner_; | 372 scoped_refptr<base::SequencedTaskRunner> default_file_task_runner_; |
| 373 | 373 |
| 374 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; | 374 scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy_; |
| 375 | 375 |
| 376 scoped_ptr<SandboxFileSystemBackendDelegate> sandbox_delegate_; | 376 scoped_ptr<SandboxFileSystemBackendDelegate> sandbox_delegate_; |
| 377 | 377 |
| 378 // Regular file system backends. | 378 // Regular file system backends. |
| 379 scoped_ptr<SandboxFileSystemBackend> sandbox_backend_; | 379 scoped_ptr<SandboxFileSystemBackend> sandbox_backend_; |
| 380 scoped_ptr<IsolatedFileSystemBackend> isolated_backend_; | 380 scoped_ptr<IsolatedFileSystemBackend> isolated_backend_; |
| 381 | 381 |
| 382 // Additional file system backends. | 382 // Additional file system backends. |
| 383 scoped_ptr<PluginPrivateFileSystemBackend> plugin_private_backend_; | 383 scoped_ptr<PluginPrivateFileSystemBackend> plugin_private_backend_; |
| 384 ScopedVector<FileSystemBackend> additional_backends_; | 384 ScopedVector<FileSystemBackend> additional_backends_; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 410 | 410 |
| 411 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemContext); | 411 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemContext); |
| 412 }; | 412 }; |
| 413 | 413 |
| 414 struct DefaultContextDeleter { | 414 struct DefaultContextDeleter { |
| 415 static void Destruct(const FileSystemContext* context) { | 415 static void Destruct(const FileSystemContext* context) { |
| 416 context->DeleteOnCorrectThread(); | 416 context->DeleteOnCorrectThread(); |
| 417 } | 417 } |
| 418 }; | 418 }; |
| 419 | 419 |
| 420 } // namespace fileapi | 420 } // namespace storage |
| 421 | 421 |
| 422 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_ | 422 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_ |
| OLD | NEW |