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