| 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_MEDIA_NATIVE_MEDIA_FILE_UTIL_H_ | 5 #ifndef WEBKIT_FILEAPI_MEDIA_NATIVE_MEDIA_FILE_UTIL_H_ |
| 6 #define WEBKIT_FILEAPI_MEDIA_NATIVE_MEDIA_FILE_UTIL_H_ | 6 #define WEBKIT_FILEAPI_MEDIA_NATIVE_MEDIA_FILE_UTIL_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "webkit/fileapi/isolated_file_util.h" | 9 #include "webkit/fileapi/isolated_file_util.h" |
| 10 #include "webkit/storage/webkit_storage_export.h" | 10 #include "webkit/storage/webkit_storage_export.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 const base::FilePath& src_file_path, | 51 const base::FilePath& src_file_path, |
| 52 const FileSystemURL& dest_url) OVERRIDE; | 52 const FileSystemURL& dest_url) OVERRIDE; |
| 53 virtual base::PlatformFileError DeleteFile( | 53 virtual base::PlatformFileError DeleteFile( |
| 54 FileSystemOperationContext* context, | 54 FileSystemOperationContext* context, |
| 55 const FileSystemURL& url) OVERRIDE; | 55 const FileSystemURL& url) OVERRIDE; |
| 56 virtual base::PlatformFileError GetFileInfo( | 56 virtual base::PlatformFileError GetFileInfo( |
| 57 FileSystemOperationContext* context, | 57 FileSystemOperationContext* context, |
| 58 const FileSystemURL& url, | 58 const FileSystemURL& url, |
| 59 base::PlatformFileInfo* file_info, | 59 base::PlatformFileInfo* file_info, |
| 60 base::FilePath* platform_path) OVERRIDE; | 60 base::FilePath* platform_path) OVERRIDE; |
| 61 virtual base::PlatformFileError CreateSnapshotFile( |
| 62 FileSystemOperationContext* context, |
| 63 const FileSystemURL& url, |
| 64 base::PlatformFileInfo* file_info, |
| 65 base::FilePath* platform_path, |
| 66 SnapshotFilePolicy* snapshot_policy) OVERRIDE; |
| 61 | 67 |
| 62 private: | 68 private: |
| 63 // Like GetLocalFilePath(), but always take media_path_filter() into | 69 // Like GetLocalFilePath(), but always take media_path_filter() into |
| 64 // consideration. If the media_path_filter() check fails, return | 70 // consideration. If the media_path_filter() check fails, return |
| 65 // PLATFORM_FILE_ERROR_SECURITY. |local_file_path| does not have to exist. | 71 // PLATFORM_FILE_ERROR_SECURITY. |local_file_path| does not have to exist. |
| 66 base::PlatformFileError GetFilteredLocalFilePath( | 72 base::PlatformFileError GetFilteredLocalFilePath( |
| 67 FileSystemOperationContext* context, | 73 FileSystemOperationContext* context, |
| 68 const FileSystemURL& file_system_url, | 74 const FileSystemURL& file_system_url, |
| 69 base::FilePath* local_file_path); | 75 base::FilePath* local_file_path); |
| 70 | 76 |
| 71 // Like GetLocalFilePath(), but if the file does not exist, then return | 77 // Like GetLocalFilePath(), but if the file does not exist, then return |
| 72 // |failure_error|. | 78 // |failure_error|. |
| 73 // If |local_file_path| is a file, then take media_path_filter() into | 79 // If |local_file_path| is a file, then take media_path_filter() into |
| 74 // consideration. | 80 // consideration. |
| 75 // If the media_path_filter() check fails, return |failure_error|. | 81 // If the media_path_filter() check fails, return |failure_error|. |
| 76 // If |local_file_path| is a directory, return PLATFORM_FILE_OK. | 82 // If |local_file_path| is a directory, return PLATFORM_FILE_OK. |
| 77 base::PlatformFileError GetFilteredLocalFilePathForExistingFileOrDirectory( | 83 base::PlatformFileError GetFilteredLocalFilePathForExistingFileOrDirectory( |
| 78 FileSystemOperationContext* context, | 84 FileSystemOperationContext* context, |
| 79 const FileSystemURL& file_system_url, | 85 const FileSystemURL& file_system_url, |
| 80 base::PlatformFileError failure_error, | 86 base::PlatformFileError failure_error, |
| 81 base::FilePath* local_file_path); | 87 base::FilePath* local_file_path); |
| 82 | 88 |
| 89 // Uses the MIME sniffer code, which actually looks into the file, |
| 90 // to determine if it is really a media file (versus a potential |
| 91 // Trojan horse.) |
| 92 bool IsMediaFile(const base::FilePath& path); |
| 93 |
| 83 DISALLOW_COPY_AND_ASSIGN(NativeMediaFileUtil); | 94 DISALLOW_COPY_AND_ASSIGN(NativeMediaFileUtil); |
| 84 }; | 95 }; |
| 85 | 96 |
| 86 } // namespace fileapi | 97 } // namespace fileapi |
| 87 | 98 |
| 88 #endif // WEBKIT_FILEAPI_MEDIA_NATIVE_MEDIA_FILE_UTIL_H_ | 99 #endif // WEBKIT_FILEAPI_MEDIA_NATIVE_MEDIA_FILE_UTIL_H_ |
| OLD | NEW |