| 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_TEST_MOUNT_POINT_PROVIDER_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_TEST_MOUNT_POINT_PROVIDER_H_ |
| 6 #define WEBKIT_BROWSER_FILEAPI_TEST_MOUNT_POINT_PROVIDER_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_TEST_MOUNT_POINT_PROVIDER_H_ |
| 7 | 7 |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/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" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE TestMountPointProvider | 28 class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE TestMountPointProvider |
| 29 : public FileSystemMountPointProvider { | 29 : public FileSystemMountPointProvider { |
| 30 public: | 30 public: |
| 31 TestMountPointProvider( | 31 TestMountPointProvider( |
| 32 base::SequencedTaskRunner* task_runner, | 32 base::SequencedTaskRunner* task_runner, |
| 33 const base::FilePath& base_path); | 33 const base::FilePath& base_path); |
| 34 virtual ~TestMountPointProvider(); | 34 virtual ~TestMountPointProvider(); |
| 35 | 35 |
| 36 // FileSystemMountPointProvider implementation. | 36 // FileSystemMountPointProvider implementation. |
| 37 virtual bool CanHandleType(FileSystemType type) const OVERRIDE; | 37 virtual bool CanHandleType(FileSystemType type) const OVERRIDE; |
| 38 virtual GURL GetRootURI(const GURL& origin_url, |
| 39 FileSystemType type) const OVERRIDE; |
| 38 virtual void OpenFileSystem( | 40 virtual void OpenFileSystem( |
| 39 const GURL& origin_url, | 41 const GURL& origin_url, |
| 40 FileSystemType type, | 42 FileSystemType type, |
| 41 OpenFileSystemMode mode, | 43 OpenFileSystemMode mode, |
| 42 const OpenFileSystemCallback& callback) OVERRIDE; | 44 const OpenFileSystemCallback& callback) OVERRIDE; |
| 43 virtual FileSystemFileUtil* GetFileUtil(FileSystemType type) OVERRIDE; | 45 virtual FileSystemFileUtil* GetFileUtil(FileSystemType type) OVERRIDE; |
| 44 virtual AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) OVERRIDE; | 46 virtual AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) OVERRIDE; |
| 45 virtual CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory( | 47 virtual CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory( |
| 46 FileSystemType type, | 48 FileSystemType type, |
| 47 base::PlatformFileError* error_code) OVERRIDE; | 49 base::PlatformFileError* error_code) OVERRIDE; |
| 48 virtual FileSystemOperation* CreateFileSystemOperation( | 50 virtual FileSystemOperation* CreateFileSystemOperation( |
| 49 const FileSystemURL& url, | 51 const FileSystemURL& url, |
| 50 FileSystemContext* context, | 52 FileSystemContext* context, |
| 51 base::PlatformFileError* error_code) const OVERRIDE; | 53 base::PlatformFileError* error_code) const OVERRIDE; |
| 52 virtual scoped_ptr<webkit_blob::FileStreamReader> CreateFileStreamReader( | 54 virtual scoped_ptr<webkit_blob::FileStreamReader> CreateFileStreamReader( |
| 53 const FileSystemURL& url, | 55 const FileSystemURL& url, |
| 54 int64 offset, | 56 int64 offset, |
| 55 const base::Time& expected_modification_time, | 57 const base::Time& expected_modification_time, |
| 56 FileSystemContext* context) const OVERRIDE; | 58 FileSystemContext* context) const OVERRIDE; |
| 57 virtual scoped_ptr<FileStreamWriter> CreateFileStreamWriter( | 59 virtual scoped_ptr<FileStreamWriter> CreateFileStreamWriter( |
| 58 const FileSystemURL& url, | 60 const FileSystemURL& url, |
| 59 int64 offset, | 61 int64 offset, |
| 60 FileSystemContext* context) const OVERRIDE; | 62 FileSystemContext* context) const OVERRIDE; |
| 61 virtual FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE; | 63 virtual FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE; |
| 64 virtual const UpdateObserverList* GetUpdateObservers( |
| 65 FileSystemType type) const OVERRIDE; |
| 62 | 66 |
| 63 // Initialize the CopyOrMoveFileValidatorFactory. Invalid to call more than | 67 // Initialize the CopyOrMoveFileValidatorFactory. Invalid to call more than |
| 64 // once. | 68 // once. |
| 65 void InitializeCopyOrMoveFileValidatorFactory( | 69 void InitializeCopyOrMoveFileValidatorFactory( |
| 66 scoped_ptr<CopyOrMoveFileValidatorFactory> factory); | 70 scoped_ptr<CopyOrMoveFileValidatorFactory> factory); |
| 67 | 71 |
| 68 const UpdateObserverList* GetUpdateObservers(FileSystemType type) const; | |
| 69 void AddFileChangeObserver(FileChangeObserver* observer); | 72 void AddFileChangeObserver(FileChangeObserver* observer); |
| 70 | 73 |
| 71 // For CopyOrMoveFileValidatorFactory testing. Once it's set to true | 74 // For CopyOrMoveFileValidatorFactory testing. Once it's set to true |
| 72 // GetCopyOrMoveFileValidatorFactory will start returning security | 75 // GetCopyOrMoveFileValidatorFactory will start returning security |
| 73 // error if validator is not initialized. | 76 // error if validator is not initialized. |
| 74 void set_require_copy_or_move_validator(bool flag) { | 77 void set_require_copy_or_move_validator(bool flag) { |
| 75 require_copy_or_move_validator_ = flag; | 78 require_copy_or_move_validator_ = flag; |
| 76 } | 79 } |
| 77 | 80 |
| 78 private: | 81 private: |
| 79 class QuotaUtil; | 82 class QuotaUtil; |
| 80 | 83 |
| 81 base::FilePath base_path_; | 84 base::FilePath base_path_; |
| 82 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 85 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
| 83 scoped_ptr<AsyncFileUtilAdapter> local_file_util_; | 86 scoped_ptr<AsyncFileUtilAdapter> local_file_util_; |
| 84 scoped_ptr<QuotaUtil> quota_util_; | 87 scoped_ptr<QuotaUtil> quota_util_; |
| 85 UpdateObserverList update_observers_; | 88 UpdateObserverList update_observers_; |
| 86 ChangeObserverList change_observers_; | 89 ChangeObserverList change_observers_; |
| 87 | 90 |
| 88 bool require_copy_or_move_validator_; | 91 bool require_copy_or_move_validator_; |
| 89 scoped_ptr<CopyOrMoveFileValidatorFactory> | 92 scoped_ptr<CopyOrMoveFileValidatorFactory> |
| 90 copy_or_move_file_validator_factory_; | 93 copy_or_move_file_validator_factory_; |
| 91 | 94 |
| 92 DISALLOW_COPY_AND_ASSIGN(TestMountPointProvider); | 95 DISALLOW_COPY_AND_ASSIGN(TestMountPointProvider); |
| 93 }; | 96 }; |
| 94 | 97 |
| 95 } // namespace fileapi | 98 } // namespace fileapi |
| 96 | 99 |
| 97 #endif // WEBKIT_BROWSER_FILEAPI_TEST_MOUNT_POINT_PROVIDER_H_ | 100 #endif // WEBKIT_BROWSER_FILEAPI_TEST_MOUNT_POINT_PROVIDER_H_ |
| OLD | NEW |