| OLD | NEW |
| (Empty) |
| 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_MEDIA_NATIVE_MEDIA_FILE_UTIL_H_ | |
| 6 #define WEBKIT_FILEAPI_MEDIA_NATIVE_MEDIA_FILE_UTIL_H_ | |
| 7 | |
| 8 #include "base/memory/scoped_ptr.h" | |
| 9 #include "webkit/fileapi/isolated_file_util.h" | |
| 10 #include "webkit/storage/webkit_storage_export.h" | |
| 11 | |
| 12 namespace fileapi { | |
| 13 | |
| 14 // This class handles native file system operations with media type filtering | |
| 15 // which is passed to each method via FileSystemOperationContext as | |
| 16 // MediaPathFilter. | |
| 17 class WEBKIT_STORAGE_EXPORT_PRIVATE NativeMediaFileUtil | |
| 18 : public IsolatedFileUtil { | |
| 19 public: | |
| 20 NativeMediaFileUtil(); | |
| 21 | |
| 22 virtual base::PlatformFileError CreateOrOpen( | |
| 23 FileSystemOperationContext* context, | |
| 24 const FileSystemURL& url, | |
| 25 int file_flags, | |
| 26 base::PlatformFile* file_handle, | |
| 27 bool* created) OVERRIDE; | |
| 28 virtual base::PlatformFileError EnsureFileExists( | |
| 29 FileSystemOperationContext* context, | |
| 30 const FileSystemURL& url, bool* created) OVERRIDE; | |
| 31 virtual scoped_ptr<AbstractFileEnumerator> CreateFileEnumerator( | |
| 32 FileSystemOperationContext* context, | |
| 33 const FileSystemURL& root_url) OVERRIDE; | |
| 34 virtual base::PlatformFileError Touch( | |
| 35 FileSystemOperationContext* context, | |
| 36 const FileSystemURL& url, | |
| 37 const base::Time& last_access_time, | |
| 38 const base::Time& last_modified_time) OVERRIDE; | |
| 39 virtual base::PlatformFileError Truncate( | |
| 40 FileSystemOperationContext* context, | |
| 41 const FileSystemURL& url, | |
| 42 int64 length) OVERRIDE; | |
| 43 virtual base::PlatformFileError CopyOrMoveFile( | |
| 44 FileSystemOperationContext* context, | |
| 45 const FileSystemURL& src_url, | |
| 46 const FileSystemURL& dest_url, | |
| 47 bool copy) OVERRIDE; | |
| 48 virtual base::PlatformFileError CopyInForeignFile( | |
| 49 FileSystemOperationContext* context, | |
| 50 const base::FilePath& src_file_path, | |
| 51 const FileSystemURL& dest_url) OVERRIDE; | |
| 52 virtual base::PlatformFileError DeleteFile( | |
| 53 FileSystemOperationContext* context, | |
| 54 const FileSystemURL& url) OVERRIDE; | |
| 55 virtual base::PlatformFileError GetFileInfo( | |
| 56 FileSystemOperationContext* context, | |
| 57 const FileSystemURL& url, | |
| 58 base::PlatformFileInfo* file_info, | |
| 59 base::FilePath* platform_path) OVERRIDE; | |
| 60 | |
| 61 private: | |
| 62 // Like GetLocalFilePath(), but always take media_path_filter() into | |
| 63 // consideration. If the media_path_filter() check fails, return | |
| 64 // PLATFORM_FILE_ERROR_SECURITY. |local_file_path| does not have to exist. | |
| 65 base::PlatformFileError GetFilteredLocalFilePath( | |
| 66 FileSystemOperationContext* context, | |
| 67 const FileSystemURL& file_system_url, | |
| 68 base::FilePath* local_file_path); | |
| 69 | |
| 70 // Like GetLocalFilePath(), but if the file does not exist, then return | |
| 71 // |failure_error|. | |
| 72 // If |local_file_path| is a file, then take media_path_filter() into | |
| 73 // consideration. | |
| 74 // If the media_path_filter() check fails, return |failure_error|. | |
| 75 // If |local_file_path| is a directory, return PLATFORM_FILE_OK. | |
| 76 base::PlatformFileError GetFilteredLocalFilePathForExistingFileOrDirectory( | |
| 77 FileSystemOperationContext* context, | |
| 78 const FileSystemURL& file_system_url, | |
| 79 base::PlatformFileError failure_error, | |
| 80 base::FilePath* local_file_path); | |
| 81 | |
| 82 DISALLOW_COPY_AND_ASSIGN(NativeMediaFileUtil); | |
| 83 }; | |
| 84 | |
| 85 } // namespace fileapi | |
| 86 | |
| 87 #endif // WEBKIT_FILEAPI_MEDIA_NATIVE_MEDIA_FILE_UTIL_H_ | |
| OLD | NEW |