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