| 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 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 using base::MessageLoopProxy; | 27 using base::MessageLoopProxy; |
| 28 using base::PlatformFile; | 28 using base::PlatformFile; |
| 29 using base::PlatformFileError; | 29 using base::PlatformFileError; |
| 30 using base::PlatformFileInfo; | 30 using base::PlatformFileInfo; |
| 31 | 31 |
| 32 // This class provides asynchronous access to common file routines for the | 32 // This class provides asynchronous access to common file routines for the |
| 33 // FileSystem API. | 33 // FileSystem API. |
| 34 class FileSystemFileUtilProxy { | 34 class FileSystemFileUtilProxy { |
| 35 public: | 35 public: |
| 36 typedef base::FileUtilProxy::Entry Entry; |
| 37 |
| 36 typedef base::FileUtilProxy::StatusCallback StatusCallback; | 38 typedef base::FileUtilProxy::StatusCallback StatusCallback; |
| 37 typedef base::FileUtilProxy::CreateOrOpenCallback CreateOrOpenCallback; | 39 typedef base::FileUtilProxy::CreateOrOpenCallback CreateOrOpenCallback; |
| 38 typedef base::FileUtilProxy::EnsureFileExistsCallback | 40 typedef base::Callback<void(PlatformFileError, |
| 39 EnsureFileExistsCallback; | 41 bool /* created */ |
| 40 typedef base::Callback< | 42 )> EnsureFileExistsCallback; |
| 41 void(PlatformFileError /* error code */, | 43 typedef base::Callback<void(PlatformFileError, |
| 42 const PlatformFileInfo& /* file_info */, | 44 const PlatformFileInfo&, |
| 43 const FilePath& /* platform_path, where possible */)> | 45 const FilePath& /* platform_path */ |
| 44 GetFileInfoCallback; | 46 )> GetFileInfoCallback; |
| 47 typedef base::Callback<void(PlatformFileError, |
| 48 const std::vector<Entry>& |
| 49 )> ReadDirectoryCallback; |
| 50 |
| 45 typedef Callback2<PlatformFileError /* error code */, | 51 typedef Callback2<PlatformFileError /* error code */, |
| 46 const FilePath& /* local_path, where possible */ | 52 const FilePath& /* local_path, where possible */ |
| 47 >::Type GetLocalPathCallback; | 53 >::Type GetLocalPathCallback; |
| 48 typedef base::FileUtilProxy::ReadDirectoryCallback ReadDirectoryCallback; | |
| 49 | 54 |
| 50 // Creates or opens a file with the given flags. It is invalid to pass NULL | 55 // Creates or opens a file with the given flags. It is invalid to pass NULL |
| 51 // for the callback. | 56 // for the callback. |
| 52 // If PLATFORM_FILE_CREATE is set in |file_flags| it always tries to create | 57 // If PLATFORM_FILE_CREATE is set in |file_flags| it always tries to create |
| 53 // a new file at the given |file_path| and calls back with | 58 // a new file at the given |file_path| and calls back with |
| 54 // PLATFORM_FILE_ERROR_FILE_EXISTS if the |file_path| already exists. | 59 // PLATFORM_FILE_ERROR_FILE_EXISTS if the |file_path| already exists. |
| 55 static bool CreateOrOpen(const FileSystemOperationContext& context, | 60 static bool CreateOrOpen(const FileSystemOperationContext& context, |
| 56 scoped_refptr<MessageLoopProxy> message_loop_proxy, | 61 scoped_refptr<MessageLoopProxy> message_loop_proxy, |
| 57 const FilePath& file_path, | 62 const FilePath& file_path, |
| 58 int file_flags, | 63 int file_flags, |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 int64 length, | 164 int64 length, |
| 160 const StatusCallback& callback); | 165 const StatusCallback& callback); |
| 161 | 166 |
| 162 private: | 167 private: |
| 163 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemFileUtilProxy); | 168 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemFileUtilProxy); |
| 164 }; | 169 }; |
| 165 | 170 |
| 166 } // namespace fileapi | 171 } // namespace fileapi |
| 167 | 172 |
| 168 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_PROXY_H_ | 173 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_PROXY_H_ |
| OLD | NEW |