| 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_ISOLATED_FILE_UTIL_H_ | 5 #ifndef WEBKIT_FILEAPI_ISOLATED_FILE_UTIL_H_ |
| 6 #define WEBKIT_FILEAPI_ISOLATED_FILE_UTIL_H_ | 6 #define WEBKIT_FILEAPI_ISOLATED_FILE_UTIL_H_ |
| 7 | 7 |
| 8 #include "base/file_path.h" | |
| 9 #include "base/file_util_proxy.h" | |
| 10 #include "base/platform_file.h" | |
| 11 #include "webkit/fileapi/fileapi_export.h" | 8 #include "webkit/fileapi/fileapi_export.h" |
| 12 #include "webkit/fileapi/file_system_file_util.h" | 9 #include "webkit/fileapi/local_file_util.h" |
| 13 | |
| 14 namespace base { | |
| 15 class Time; | |
| 16 } | |
| 17 | 10 |
| 18 namespace fileapi { | 11 namespace fileapi { |
| 19 | 12 |
| 20 class FileSystemOperationContext; | 13 class FileSystemOperationContext; |
| 21 class IsolatedContext; | |
| 22 | 14 |
| 23 class FILEAPI_EXPORT_PRIVATE IsolatedFileUtil : public FileSystemFileUtil { | 15 class FILEAPI_EXPORT_PRIVATE IsolatedFileUtil : public LocalFileUtil { |
| 24 public: | 16 public: |
| 25 IsolatedFileUtil(); | 17 IsolatedFileUtil(); |
| 26 virtual ~IsolatedFileUtil() {} | 18 virtual ~IsolatedFileUtil() {} |
| 27 | 19 |
| 20 // LocalFileUtil overrides. |
| 21 virtual PlatformFileError GetLocalFilePath( |
| 22 FileSystemOperationContext* context, |
| 23 const FileSystemURL& file_system_url, |
| 24 FilePath* local_file_path) OVERRIDE; |
| 25 }; |
| 26 |
| 27 // Dragged file system is a specialized IsolatedFileUtil where read access to |
| 28 // the virtual root directory (i.e. empty cracked path case) is allowed |
| 29 // and single isolated context may be associated with multiple file paths. |
| 30 class FILEAPI_EXPORT_PRIVATE DraggedFileUtil : public IsolatedFileUtil { |
| 31 public: |
| 32 DraggedFileUtil(); |
| 33 virtual ~DraggedFileUtil() {} |
| 34 |
| 28 // FileSystemFileUtil overrides. | 35 // FileSystemFileUtil overrides. |
| 29 virtual base::PlatformFileError CreateOrOpen( | |
| 30 FileSystemOperationContext* context, | |
| 31 const FileSystemURL& url, | |
| 32 int file_flags, | |
| 33 base::PlatformFile* file_handle, | |
| 34 bool* created) OVERRIDE; | |
| 35 virtual base::PlatformFileError Close( | |
| 36 FileSystemOperationContext* context, | |
| 37 base::PlatformFile file) OVERRIDE; | |
| 38 virtual base::PlatformFileError EnsureFileExists( | |
| 39 FileSystemOperationContext* context, | |
| 40 const FileSystemURL& url, bool* created) OVERRIDE; | |
| 41 virtual base::PlatformFileError CreateDirectory( | |
| 42 FileSystemOperationContext* context, | |
| 43 const FileSystemURL& url, | |
| 44 bool exclusive, | |
| 45 bool recursive) OVERRIDE; | |
| 46 virtual base::PlatformFileError GetFileInfo( | 36 virtual base::PlatformFileError GetFileInfo( |
| 47 FileSystemOperationContext* context, | 37 FileSystemOperationContext* context, |
| 48 const FileSystemURL& url, | 38 const FileSystemURL& url, |
| 49 base::PlatformFileInfo* file_info, | 39 base::PlatformFileInfo* file_info, |
| 50 FilePath* platform_path) OVERRIDE; | 40 FilePath* platform_path) OVERRIDE; |
| 51 virtual AbstractFileEnumerator* CreateFileEnumerator( | 41 virtual AbstractFileEnumerator* CreateFileEnumerator( |
| 52 FileSystemOperationContext* context, | 42 FileSystemOperationContext* context, |
| 53 const FileSystemURL& root_url, | 43 const FileSystemURL& root_url, |
| 54 bool recursive) OVERRIDE; | 44 bool recursive) OVERRIDE; |
| 55 virtual PlatformFileError GetLocalFilePath( | |
| 56 FileSystemOperationContext* context, | |
| 57 const FileSystemURL& file_system_url, | |
| 58 FilePath* local_file_path) OVERRIDE; | |
| 59 virtual base::PlatformFileError Touch( | |
| 60 FileSystemOperationContext* context, | |
| 61 const FileSystemURL& url, | |
| 62 const base::Time& last_access_time, | |
| 63 const base::Time& last_modified_time) OVERRIDE; | |
| 64 virtual base::PlatformFileError Truncate( | |
| 65 FileSystemOperationContext* context, | |
| 66 const FileSystemURL& url, | |
| 67 int64 length) OVERRIDE; | |
| 68 virtual bool PathExists( | 45 virtual bool PathExists( |
| 69 FileSystemOperationContext* context, | 46 FileSystemOperationContext* context, |
| 70 const FileSystemURL& url) OVERRIDE; | 47 const FileSystemURL& url) OVERRIDE; |
| 71 virtual bool DirectoryExists( | 48 virtual bool DirectoryExists( |
| 72 FileSystemOperationContext* context, | 49 FileSystemOperationContext* context, |
| 73 const FileSystemURL& url) OVERRIDE; | 50 const FileSystemURL& url) OVERRIDE; |
| 74 virtual bool IsDirectoryEmpty( | 51 virtual bool IsDirectoryEmpty( |
| 75 FileSystemOperationContext* context, | 52 FileSystemOperationContext* context, |
| 76 const FileSystemURL& url) OVERRIDE; | 53 const FileSystemURL& url) OVERRIDE; |
| 77 virtual base::PlatformFileError CopyOrMoveFile( | |
| 78 FileSystemOperationContext* context, | |
| 79 const FileSystemURL& src_url, | |
| 80 const FileSystemURL& dest_url, | |
| 81 bool copy) OVERRIDE; | |
| 82 virtual base::PlatformFileError CopyInForeignFile( | |
| 83 FileSystemOperationContext* context, | |
| 84 const FilePath& src_file_path, | |
| 85 const FileSystemURL& dest_url) OVERRIDE; | |
| 86 virtual base::PlatformFileError DeleteFile( | |
| 87 FileSystemOperationContext* context, | |
| 88 const FileSystemURL& url) OVERRIDE; | |
| 89 virtual base::PlatformFileError DeleteSingleDirectory( | |
| 90 FileSystemOperationContext* context, | |
| 91 const FileSystemURL& url) OVERRIDE; | |
| 92 virtual scoped_refptr<webkit_blob::ShareableFileReference> | |
| 93 CreateSnapshotFile(FileSystemOperationContext* context, | |
| 94 const FileSystemURL& url, | |
| 95 base::PlatformFileError* result, | |
| 96 base::PlatformFileInfo* file_info, | |
| 97 FilePath* platform_path) OVERRIDE; | |
| 98 | 54 |
| 99 private: | 55 private: |
| 100 // Returns false if the given |url| is not a valid path. | 56 // Returns false if the given |url| is not a valid path. |
| 101 bool GetPlatformPath(const FileSystemURL& url, | 57 bool GetPlatformPath(const FileSystemURL& url, |
| 102 FilePath* platform_path) const; | 58 FilePath* platform_path) const; |
| 103 DISALLOW_COPY_AND_ASSIGN(IsolatedFileUtil); | 59 DISALLOW_COPY_AND_ASSIGN(DraggedFileUtil); |
| 104 }; | 60 }; |
| 105 | 61 |
| 106 } // namespace fileapi | 62 } // namespace fileapi |
| 107 | 63 |
| 108 #endif // WEBKIT_FILEAPI_ISOLATED_FILE_UTIL_H_ | 64 #endif // WEBKIT_FILEAPI_ISOLATED_FILE_UTIL_H_ |
| OLD | NEW |