| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_FILE_SYSTEM_FILE_UTIL_PROXY_H_ | 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_PROXY_H_ |
| 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_PROXY_H_ | 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_PROXY_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 class FileSystemFileUtilProxy { | 33 class FileSystemFileUtilProxy { |
| 34 public: | 34 public: |
| 35 typedef base::FileUtilProxy::StatusCallback StatusCallback; | 35 typedef base::FileUtilProxy::StatusCallback StatusCallback; |
| 36 typedef base::FileUtilProxy::CreateOrOpenCallback CreateOrOpenCallback; | 36 typedef base::FileUtilProxy::CreateOrOpenCallback CreateOrOpenCallback; |
| 37 typedef base::FileUtilProxy::EnsureFileExistsCallback | 37 typedef base::FileUtilProxy::EnsureFileExistsCallback |
| 38 EnsureFileExistsCallback; | 38 EnsureFileExistsCallback; |
| 39 typedef Callback3<PlatformFileError /* error code */, | 39 typedef Callback3<PlatformFileError /* error code */, |
| 40 const PlatformFileInfo& /* file_info */, | 40 const PlatformFileInfo& /* file_info */, |
| 41 const FilePath& /* platform_path, where possible */ | 41 const FilePath& /* platform_path, where possible */ |
| 42 >::Type GetFileInfoCallback; | 42 >::Type GetFileInfoCallback; |
| 43 typedef Callback2<PlatformFileError /* error code */, |
| 44 const FilePath& /* local_path, where possible */ |
| 45 >::Type GetLocalPathCallback; |
| 43 typedef base::FileUtilProxy::ReadDirectoryCallback ReadDirectoryCallback; | 46 typedef base::FileUtilProxy::ReadDirectoryCallback ReadDirectoryCallback; |
| 44 | 47 |
| 45 // Creates or opens a file with the given flags. It is invalid to pass NULL | 48 // Creates or opens a file with the given flags. It is invalid to pass NULL |
| 46 // for the callback. | 49 // for the callback. |
| 47 // If PLATFORM_FILE_CREATE is set in |file_flags| it always tries to create | 50 // If PLATFORM_FILE_CREATE is set in |file_flags| it always tries to create |
| 48 // a new file at the given |file_path| and calls back with | 51 // a new file at the given |file_path| and calls back with |
| 49 // PLATFORM_FILE_ERROR_FILE_EXISTS if the |file_path| already exists. | 52 // PLATFORM_FILE_ERROR_FILE_EXISTS if the |file_path| already exists. |
| 50 static bool CreateOrOpen(const FileSystemOperationContext& context, | 53 static bool CreateOrOpen(const FileSystemOperationContext& context, |
| 51 scoped_refptr<MessageLoopProxy> message_loop_proxy, | 54 scoped_refptr<MessageLoopProxy> message_loop_proxy, |
| 52 const FilePath& file_path, | 55 const FilePath& file_path, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 67 // If the file already exists, |created| is set false and |error code| | 70 // If the file already exists, |created| is set false and |error code| |
| 68 // is set PLATFORM_FILE_OK. | 71 // is set PLATFORM_FILE_OK. |
| 69 // If the file hasn't existed but it couldn't be created for some other | 72 // If the file hasn't existed but it couldn't be created for some other |
| 70 // reasons, |created| is set false and |error code| indicates the error. | 73 // reasons, |created| is set false and |error code| indicates the error. |
| 71 static bool EnsureFileExists( | 74 static bool EnsureFileExists( |
| 72 const FileSystemOperationContext& context, | 75 const FileSystemOperationContext& context, |
| 73 scoped_refptr<MessageLoopProxy> message_loop_proxy, | 76 scoped_refptr<MessageLoopProxy> message_loop_proxy, |
| 74 const FilePath& file_path, | 77 const FilePath& file_path, |
| 75 EnsureFileExistsCallback* callback); | 78 EnsureFileExistsCallback* callback); |
| 76 | 79 |
| 80 // Maps virtual file patch to its local physical location. |
| 81 static bool GetLocalPath( |
| 82 const FileSystemOperationContext& context, |
| 83 scoped_refptr<MessageLoopProxy> message_loop_proxy, |
| 84 const FilePath& virtual_path, |
| 85 GetLocalPathCallback* callback); |
| 86 |
| 77 // Retrieves the information about a file. It is invalid to pass NULL for the | 87 // Retrieves the information about a file. It is invalid to pass NULL for the |
| 78 // callback. | 88 // callback. |
| 79 static bool GetFileInfo( | 89 static bool GetFileInfo( |
| 80 const FileSystemOperationContext& context, | 90 const FileSystemOperationContext& context, |
| 81 scoped_refptr<MessageLoopProxy> message_loop_proxy, | 91 scoped_refptr<MessageLoopProxy> message_loop_proxy, |
| 82 const FilePath& file_path, | 92 const FilePath& file_path, |
| 83 GetFileInfoCallback* callback); | 93 GetFileInfoCallback* callback); |
| 84 | 94 |
| 85 static bool ReadDirectory(const FileSystemOperationContext& context, | 95 static bool ReadDirectory(const FileSystemOperationContext& context, |
| 86 scoped_refptr<MessageLoopProxy> message_loop_proxy, | 96 scoped_refptr<MessageLoopProxy> message_loop_proxy, |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 int64 length, | 157 int64 length, |
| 148 StatusCallback* callback); | 158 StatusCallback* callback); |
| 149 | 159 |
| 150 private: | 160 private: |
| 151 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemFileUtilProxy); | 161 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemFileUtilProxy); |
| 152 }; | 162 }; |
| 153 | 163 |
| 154 } // namespace fileapi | 164 } // namespace fileapi |
| 155 | 165 |
| 156 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_PROXY_H_ | 166 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_PROXY_H_ |
| OLD | NEW |