| 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 base::PlatformFileError IsMediaFile(const base::FilePath& path); |
| 58 | 69 |
| 59 private: | 70 private: |
| 60 // Like GetLocalFilePath(), but always take media_path_filter() into | 71 // Like GetLocalFilePath(), but always take media_path_filter() into |
| 61 // consideration. If the media_path_filter() check fails, return | 72 // consideration. If the media_path_filter() check fails, return |
| 62 // PLATFORM_FILE_ERROR_SECURITY. |local_file_path| does not have to exist. | 73 // PLATFORM_FILE_ERROR_SECURITY. |local_file_path| does not have to exist. |
| 63 base::PlatformFileError GetFilteredLocalFilePath( | 74 base::PlatformFileError GetFilteredLocalFilePath( |
| 64 fileapi::FileSystemOperationContext* context, | 75 fileapi::FileSystemOperationContext* context, |
| 65 const fileapi::FileSystemURL& file_system_url, | 76 const fileapi::FileSystemURL& file_system_url, |
| 66 base::FilePath* local_file_path); | 77 base::FilePath* local_file_path); |
| 67 | 78 |
| 68 // Like GetLocalFilePath(), but if the file does not exist, then return | 79 // Like GetLocalFilePath(), but if the file does not exist, then return |
| 69 // |failure_error|. | 80 // |failure_error|. |
| 70 // If |local_file_path| is a file, then take media_path_filter() into | 81 // If |local_file_path| is a file, then take media_path_filter() into |
| 71 // consideration. | 82 // consideration. |
| 72 // If the media_path_filter() check fails, return |failure_error|. | 83 // If the media_path_filter() check fails, return |failure_error|. |
| 73 // If |local_file_path| is a directory, return PLATFORM_FILE_OK. | 84 // If |local_file_path| is a directory, return PLATFORM_FILE_OK. |
| 74 base::PlatformFileError GetFilteredLocalFilePathForExistingFileOrDirectory( | 85 base::PlatformFileError GetFilteredLocalFilePathForExistingFileOrDirectory( |
| 75 fileapi::FileSystemOperationContext* context, | 86 fileapi::FileSystemOperationContext* context, |
| 76 const fileapi::FileSystemURL& file_system_url, | 87 const fileapi::FileSystemURL& file_system_url, |
| 77 base::PlatformFileError failure_error, | 88 base::PlatformFileError failure_error, |
| 78 base::FilePath* local_file_path); | 89 base::FilePath* local_file_path); |
| 79 | 90 |
| 80 DISALLOW_COPY_AND_ASSIGN(NativeMediaFileUtil); | 91 DISALLOW_COPY_AND_ASSIGN(NativeMediaFileUtil); |
| 81 }; | 92 }; |
| 82 | 93 |
| 83 } // namespace chrome | 94 } // namespace chrome |
| 84 | 95 |
| 85 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_NATIVE_MEDIA_FILE_UTIL_H_ | 96 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_NATIVE_MEDIA_FILE_UTIL_H_ |
| OLD | NEW |