Chromium Code Reviews| Index: base/file_util_proxy.h |
| =================================================================== |
| --- base/file_util_proxy.h (revision 58250) |
| +++ base/file_util_proxy.h (working copy) |
| @@ -2,10 +2,14 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#ifndef BASE_FILE_SYSTEM_PROXY_H_ |
| -#define BASE_FILE_SYSTEM_PROXY_H_ |
| +#ifndef BASE_FILE_UTIL_PROXY_H_ |
| +#define BASE_FILE_UTIL_PROXY_H_ |
| +#include <vector> |
| + |
| #include "base/callback.h" |
| +#include "base/file_path.h" |
| +#include "base/file_util.h" |
| #include "base/platform_file.h" |
| #include "base/ref_counted.h" |
| #include "base/tracked_objects.h" |
| @@ -16,6 +20,14 @@ |
| namespace base { |
| +namespace file_util_proxy { |
|
darin (slow to review)
2010/11/01 17:28:38
introducing the file_util_proxy namespace like thi
Kavita Kanetkar
2010/11/01 19:00:30
Sending a follow-up CL to move this within the Fil
|
| + // Holds metadata for file or directory entry. |
| +struct Entry { |
| + FilePath::StringType name; |
| + bool isDirectory; |
| +}; |
| +} // namespace file_util_proxy |
| + |
| class MessageLoopProxy; |
| // This class provides asynchronous access to common file routines. |
| @@ -51,31 +63,66 @@ |
| base::PlatformFile, |
| StatusCallback* callback); |
| + // Retrieves the information about a file. It is invalid to pass NULL for the |
| + // callback. |
| + typedef Callback2<base::PlatformFileError /* error code */, |
| + const file_util::FileInfo& /*file_info*/ |
| + >::Type GetFileInfoCallback; |
| + static bool GetFileInfo( |
| + scoped_refptr<MessageLoopProxy> message_loop_proxy, |
| + const FilePath& file_path, |
| + GetFileInfoCallback* callback); |
| + |
| + typedef Callback2<base::PlatformFileError /* error code */, |
|
darin (slow to review)
2010/11/01 17:28:38
nit: no need to mention "base::" when you are insi
|
| + const std::vector<base::file_util_proxy::Entry>& |
| + >::Type ReadDirectoryCallback; |
| + static bool ReadDirectory(scoped_refptr<MessageLoopProxy> message_loop_proxy, |
| + const FilePath& file_path, |
| + ReadDirectoryCallback* callback); |
| + |
| + // Copies a file or a directory from |src_file_path| to |dest_file_path| |
| + // Error cases: |
| + // If destination file doesn't exist or destination's parent |
| + // doesn't exists. |
| + // If source dir exists but destination path is an existing file. |
| + // If source is a parent of destination. |
| + // If source doesn't exists. |
| + static bool Copy(scoped_refptr<MessageLoopProxy> message_loop_proxy, |
| + const FilePath& src_file_path, |
| + const FilePath& dest_file_path, |
| + StatusCallback* callback); |
| + |
| + // Creates directory at given path. It's an error to create |
| + // if |exclusive| is true and dir already exists. |
| + static bool CreateDirectory( |
| + scoped_refptr<MessageLoopProxy> message_loop_proxy, |
| + const FilePath& file_path, |
| + bool exclusive, |
| + StatusCallback* callback); |
| + |
| // Deletes a file or empty directory. |
| static bool Delete(scoped_refptr<MessageLoopProxy> message_loop_proxy, |
| const FilePath& file_path, |
| StatusCallback* callback); |
| + // Moves a file or a directory from src_file_path to dest_file_path. |
| + // Error cases are similar to Copy method's error cases. |
| + static bool Move( |
| + scoped_refptr<MessageLoopProxy> message_loop_proxy, |
| + const FilePath& src_file_path, |
| + const FilePath& dest_file_path, |
| + StatusCallback* callback); |
| + |
| // Deletes a directory and all of its contents. |
| static bool RecursiveDelete( |
| scoped_refptr<MessageLoopProxy> message_loop_proxy, |
| const FilePath& file_path, |
| StatusCallback* callback); |
| - // Retrieves the information about a file. It is invalid to pass NULL for the |
| - // callback. |
| - typedef Callback2<base::PlatformFileError /* error code */, |
| - const file_util::FileInfo& /*file_info*/ |
| - >::Type GetFileInfoCallback; |
| - static bool GetFileInfo( |
| - scoped_refptr<MessageLoopProxy> message_loop_proxy, |
| - const FilePath& file_path, |
| - GetFileInfoCallback* callback); |
| - |
| private: |
| DISALLOW_IMPLICIT_CONSTRUCTORS(FileUtilProxy); |
| }; |
| -} // namespace base |
| +} // namespace base |
| -#endif // BASE_FILE_SYSTEM_PROXY_H_ |
| +#endif // BASE_FILE_UTIL_PROXY_H_ |