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; |
| 67 |
| 68 // Uses the MIME sniffer code, which actually looks into the file, |
| 69 // to determine if it is really a media file (to avoid exposing |
| 70 // non-media files with a media file extension.) |
| 71 static base::PlatformFileError IsMediaFile(const base::FilePath& path); |
61 | 72 |
62 private: | 73 private: |
63 // Like GetLocalFilePath(), but always take media_path_filter() into | 74 // Like GetLocalFilePath(), but always take media_path_filter() into |
64 // consideration. If the media_path_filter() check fails, return | 75 // consideration. If the media_path_filter() check fails, return |
65 // PLATFORM_FILE_ERROR_SECURITY. |local_file_path| does not have to exist. | 76 // PLATFORM_FILE_ERROR_SECURITY. |local_file_path| does not have to exist. |
66 base::PlatformFileError GetFilteredLocalFilePath( | 77 base::PlatformFileError GetFilteredLocalFilePath( |
67 FileSystemOperationContext* context, | 78 FileSystemOperationContext* context, |
68 const FileSystemURL& file_system_url, | 79 const FileSystemURL& file_system_url, |
69 base::FilePath* local_file_path); | 80 base::FilePath* local_file_path); |
70 | 81 |
71 // Like GetLocalFilePath(), but if the file does not exist, then return | 82 // Like GetLocalFilePath(), but if the file does not exist, then return |
72 // |failure_error|. | 83 // |failure_error|. |
73 // If |local_file_path| is a file, then take media_path_filter() into | 84 // If |local_file_path| is a file, then take media_path_filter() into |
74 // consideration. | 85 // consideration. |
75 // If the media_path_filter() check fails, return |failure_error|. | 86 // If the media_path_filter() check fails, return |failure_error|. |
76 // If |local_file_path| is a directory, return PLATFORM_FILE_OK. | 87 // If |local_file_path| is a directory, return PLATFORM_FILE_OK. |
77 base::PlatformFileError GetFilteredLocalFilePathForExistingFileOrDirectory( | 88 base::PlatformFileError GetFilteredLocalFilePathForExistingFileOrDirectory( |
78 FileSystemOperationContext* context, | 89 FileSystemOperationContext* context, |
79 const FileSystemURL& file_system_url, | 90 const FileSystemURL& file_system_url, |
80 base::PlatformFileError failure_error, | 91 base::PlatformFileError failure_error, |
81 base::FilePath* local_file_path); | 92 base::FilePath* local_file_path); |
82 | 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 |