| 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_TEST_MOUNT_POINT_PROVIDER_H_ | 5 #ifndef WEBKIT_FILEAPI_TEST_MOUNT_POINT_PROVIDER_H_ |
| 6 #define WEBKIT_FILEAPI_TEST_MOUNT_POINT_PROVIDER_H_ | 6 #define WEBKIT_FILEAPI_TEST_MOUNT_POINT_PROVIDER_H_ |
| 7 | 7 |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "webkit/fileapi/fileapi_export.h" | 11 #include "webkit/fileapi/fileapi_export.h" |
| 12 #include "webkit/fileapi/file_system_mount_point_provider.h" | 12 #include "webkit/fileapi/file_system_mount_point_provider.h" |
| 13 | 13 |
| 14 namespace base { | 14 namespace base { |
| 15 class SequencedTaskRunner; | 15 class SequencedTaskRunner; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace fileapi { | 18 namespace fileapi { |
| 19 | 19 |
| 20 class LocalFileUtil; | 20 class LocalFileUtil; |
| 21 class FileSystemQuotaUtil; | 21 class FileSystemQuotaUtil; |
| 22 | 22 |
| 23 // This should be only used for testing. | 23 // This should be only used for testing. |
| 24 // This mount point provider uses LocalFileUtil and stores data file | 24 // This mount point provider uses LocalFileUtil and stores data file |
| 25 // under the given directory. | 25 // under the given directory. |
| 26 class FILEAPI_EXPORT_PRIVATE TestMountPointProvider | 26 class FILEAPI_EXPORT_PRIVATE TestMountPointProvider |
| 27 : public FileSystemMountPointProvider { | 27 : public FileSystemMountPointProvider { |
| 28 public: | 28 public: |
| 29 typedef FileSystemMountPointProvider::ValidateFileSystemCallback | 29 using FileSystemMountPointProvider::ValidateFileSystemCallback; |
| 30 ValidateFileSystemCallback; | 30 using FileSystemMountPointProvider::DeleteFileSystemCallback; |
| 31 | 31 |
| 32 TestMountPointProvider( | 32 TestMountPointProvider( |
| 33 base::SequencedTaskRunner* task_runner, | 33 base::SequencedTaskRunner* task_runner, |
| 34 const FilePath& base_path); | 34 const FilePath& base_path); |
| 35 virtual ~TestMountPointProvider(); | 35 virtual ~TestMountPointProvider(); |
| 36 | 36 |
| 37 // FileSystemMountPointProvider implementation. | 37 // FileSystemMountPointProvider implementation. |
| 38 virtual void ValidateFileSystemRoot( | 38 virtual void ValidateFileSystemRoot( |
| 39 const GURL& origin_url, | 39 const GURL& origin_url, |
| 40 FileSystemType type, | 40 FileSystemType type, |
| 41 bool create, | 41 bool create, |
| 42 const ValidateFileSystemCallback& callback) OVERRIDE; | 42 const ValidateFileSystemCallback& callback) OVERRIDE; |
| 43 virtual FilePath GetFileSystemRootPathOnFileThread( | 43 virtual FilePath GetFileSystemRootPathOnFileThread( |
| 44 const GURL& origin_url, | 44 const GURL& origin_url, |
| 45 FileSystemType type, | 45 FileSystemType type, |
| 46 const FilePath& virtual_path, | 46 const FilePath& virtual_path, |
| 47 bool create) OVERRIDE; | 47 bool create) OVERRIDE; |
| 48 virtual bool IsAccessAllowed(const GURL& origin_url, | 48 virtual bool IsAccessAllowed(const GURL& origin_url, |
| 49 FileSystemType type, | 49 FileSystemType type, |
| 50 const FilePath& virtual_path) OVERRIDE; | 50 const FilePath& virtual_path) OVERRIDE; |
| 51 virtual bool IsRestrictedFileName(const FilePath& filename) const OVERRIDE; | 51 virtual bool IsRestrictedFileName(const FilePath& filename) const OVERRIDE; |
| 52 virtual FileSystemFileUtil* GetFileUtil(FileSystemType type) OVERRIDE; | 52 virtual FileSystemFileUtil* GetFileUtil(FileSystemType type) OVERRIDE; |
| 53 virtual FilePath GetPathForPermissionsCheck(const FilePath& virtual_path) | 53 virtual FilePath GetPathForPermissionsCheck(const FilePath& virtual_path) |
| 54 const OVERRIDE; | 54 const OVERRIDE; |
| 55 virtual FileSystemOperationInterface* CreateFileSystemOperation( | 55 virtual FileSystemOperationInterface* CreateFileSystemOperation( |
| 56 const FileSystemURL& url, | 56 const FileSystemURL& url, |
| 57 FileSystemContext* context) const OVERRIDE; | 57 FileSystemContext* context) const OVERRIDE; |
| 58 virtual webkit_blob::FileStreamReader* CreateFileStreamReader( | 58 virtual webkit_blob::FileStreamReader* CreateFileStreamReader( |
| 59 const FileSystemURL& url, | 59 const FileSystemURL& url, |
| 60 int64 offset, | 60 int64 offset, |
| 61 FileSystemContext* context) const OVERRIDE; | 61 FileSystemContext* context) const OVERRIDE; |
| 62 virtual FileStreamWriter* CreateFileStreamWriter( | 62 virtual FileStreamWriter* CreateFileStreamWriter( |
| 63 const FileSystemURL& url, | 63 const FileSystemURL& url, |
| 64 int64 offset, | 64 int64 offset, |
| 65 FileSystemContext* context) const OVERRIDE; | 65 FileSystemContext* context) const OVERRIDE; |
| 66 virtual FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE; | 66 virtual FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE; |
| 67 virtual void DeleteFileSystem( |
| 68 const GURL& origin_url, |
| 69 FileSystemType type, |
| 70 FileSystemContext* context, |
| 71 const DeleteFileSystemCallback& callback) OVERRIDE; |
| 67 | 72 |
| 68 private: | 73 private: |
| 69 FilePath base_path_; | 74 FilePath base_path_; |
| 70 scoped_ptr<LocalFileUtil> local_file_util_; | 75 scoped_ptr<LocalFileUtil> local_file_util_; |
| 71 scoped_ptr<FileSystemQuotaUtil> quota_util_; | 76 scoped_ptr<FileSystemQuotaUtil> quota_util_; |
| 72 }; | 77 }; |
| 73 | 78 |
| 74 } // namespace fileapi | 79 } // namespace fileapi |
| 75 | 80 |
| 76 #endif // WEBKIT_FILEAPI_TEST_MOUNT_POINT_PROVIDER_H_ | 81 #endif // WEBKIT_FILEAPI_TEST_MOUNT_POINT_PROVIDER_H_ |
| OLD | NEW |