| 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" |
| 11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "base/file_util_proxy.h" | 12 #include "base/file_util_proxy.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/platform_file.h" | 14 #include "base/platform_file.h" |
| 15 #include "base/tracked_objects.h" | 15 #include "base/tracked_objects.h" |
| 16 | 16 |
| 17 namespace base { | 17 namespace base { |
| 18 class MessageLoopProxy; | 18 class MessageLoopProxy; |
| 19 class Time; | 19 class Time; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace fileapi { | 22 namespace fileapi { |
| 23 | 23 |
| 24 class FileSystemOperationContext; | 24 class FileSystemOperationContext; |
| 25 | 25 |
| 26 using base::MessageLoopProxy; | 26 using base::MessageLoopProxy; |
| 27 using base::PlatformFile; | 27 using base::PlatformFile; |
| 28 using base::PlatformFileError; |
| 29 using base::PlatformFileInfo; |
| 28 | 30 |
| 29 // This class provides asynchronous access to common file routines for the | 31 // This class provides asynchronous access to common file routines for the |
| 30 // FileSystem API. | 32 // FileSystem API. |
| 31 class FileSystemFileUtilProxy { | 33 class FileSystemFileUtilProxy { |
| 32 public: | 34 public: |
| 33 typedef base::FileUtilProxy::StatusCallback StatusCallback; | 35 typedef base::FileUtilProxy::StatusCallback StatusCallback; |
| 34 typedef base::FileUtilProxy::CreateOrOpenCallback CreateOrOpenCallback; | 36 typedef base::FileUtilProxy::CreateOrOpenCallback CreateOrOpenCallback; |
| 35 typedef base::FileUtilProxy::EnsureFileExistsCallback | 37 typedef base::FileUtilProxy::EnsureFileExistsCallback |
| 36 EnsureFileExistsCallback; | 38 EnsureFileExistsCallback; |
| 37 typedef base::FileUtilProxy::GetFileInfoCallback GetFileInfoCallback; | 39 typedef Callback3<PlatformFileError /* error code */, |
| 40 const PlatformFileInfo& /* file_info */, |
| 41 const FilePath& /* platform_path, where possible */ |
| 42 >::Type GetFileInfoCallback; |
| 38 typedef base::FileUtilProxy::ReadDirectoryCallback ReadDirectoryCallback; | 43 typedef base::FileUtilProxy::ReadDirectoryCallback ReadDirectoryCallback; |
| 39 | 44 |
| 40 // Creates or opens a file with the given flags. It is invalid to pass NULL | 45 // Creates or opens a file with the given flags. It is invalid to pass NULL |
| 41 // for the callback. | 46 // for the callback. |
| 42 // If PLATFORM_FILE_CREATE is set in |file_flags| it always tries to create | 47 // If PLATFORM_FILE_CREATE is set in |file_flags| it always tries to create |
| 43 // a new file at the given |file_path| and calls back with | 48 // a new file at the given |file_path| and calls back with |
| 44 // PLATFORM_FILE_ERROR_FILE_EXISTS if the |file_path| already exists. | 49 // PLATFORM_FILE_ERROR_FILE_EXISTS if the |file_path| already exists. |
| 45 static bool CreateOrOpen(const FileSystemOperationContext& context, | 50 static bool CreateOrOpen(const FileSystemOperationContext& context, |
| 46 scoped_refptr<MessageLoopProxy> message_loop_proxy, | 51 scoped_refptr<MessageLoopProxy> message_loop_proxy, |
| 47 const FilePath& file_path, | 52 const FilePath& file_path, |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 int64 length, | 147 int64 length, |
| 143 StatusCallback* callback); | 148 StatusCallback* callback); |
| 144 | 149 |
| 145 private: | 150 private: |
| 146 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemFileUtilProxy); | 151 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemFileUtilProxy); |
| 147 }; | 152 }; |
| 148 | 153 |
| 149 } // namespace fileapi | 154 } // namespace fileapi |
| 150 | 155 |
| 151 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_PROXY_H_ | 156 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_PROXY_H_ |
| OLD | NEW |