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