Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(854)

Unified Diff: base/file_util_proxy.h

Issue 3212002: Changes for browser-side implementation for file api.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/file_util_proxy.cc » ('j') | chrome/chrome_browser.gypi » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« no previous file with comments | « no previous file | base/file_util_proxy.cc » ('j') | chrome/chrome_browser.gypi » ('J')

Powered by Google App Engine
This is Rietveld 408576698